11-18-2015 06:20 AM
Hello, I am a LabView fresh learner and I am doing a project call Sound Merger.
This project goal is merge 2 (or more) music instrument tones, and get the averaged tones.
https://en.wikipedia.org/wiki/Piano_key_frequencies
Lets take the example of Piano, it has 88 keys which mean 88 tones, each tone has it own frequency.
For my project, if the user chosse the input tones of Key88(4186.01Hz) and Key86(3729.31Hz),
then the expected output of averaged tones should be ( (4186.01Hz + 3729.31Hz) / 2 = 3957.66Hz ) ,
which mean the output tone is close to Key87(3951.07Hz).
My piano tones files are download from freesound.org
https://freesound.org/people/pinkyfinger/packs/4409
I use the "File Path Control" to read the tone files and wire it to simple read
Sound files(wav) Front Panel Block diagram
I was studying the output of simple read, because the information tell me the data is an array of waveforms, so I guess to get the averaged tone,
maybe I should do the way
a) put them in wavefomrs, average the 2 waveforms, play the averaged wavefomrs
b) put them in array, average the 2 arrays , convert back to sound data and play it
By the way, I do not know implement both the ways, and I am not sure wheter the ways are correct.
I hope you guys can guide me, I will very appreciate about that.
Solved! Go to Solution.
11-18-2015 07:27 AM
Not a bad project, and it will teach you something about sound, waves, etc. [Have you had physics? Do you have a familiarity with music, i.e. have you played an instrument, especially the piano?]
Here's an experiment to try. Consider middle C on the piano (roughly 256Hz). Consider the C an octave above it (roughly 512 Hz). Play both at the same time. What notes do you hear? If you know music, you'll know that you only hear the note "C" (though it may be tricky to figure out which octave(s)). Yet the average of 256 and 512 is 384, which is close to a G. Hmm, maybe averaging sounds is a little more complicated than averaging their frequencies ...
Bob Schor
11-18-2015 10:03 PM
Thanks for reply, I studied physics but my foundation is not strong and I actually know nothing about music instrument.
I was use the "+" operator collect the 2 data together and play it, it is just the 2 sounds mixed together, doesn't generate averaged sound.
So I think I should do the average in waveforms or average in array way, would you mind to teach me implement one of them?
I also seen the virtual piano project in Labview, the tones are generated by sound simulator, which input certain frequency value,
may be the third way should get the 2 frequency values of the 2 sounds, averaged them then input to simulator, is there any labview block can collect sound frequency?
11-19-2015 06:36 AM - edited 11-19-2015 06:47 AM
@Raydivine wrote:
I also seen the virtual piano project in Labview, the tones are generated by sound simulator, which input certain frequency value,
may be the third way should get the 2 frequency values of the 2 sounds, averaged them then input to simulator, is there any labview block can collect sound frequency?
Hi!
There is this promising Multitone Generator VI:
http://zone.ni.com/reference/en-XX/help/371361K-01/lvwave/multitone_generator/
...but I have never used it.
Thanks for reply, I studied physics but my foundation is not strong and I actually know nothing about music instrument.
Maybe this online course from Ed Doering is a good start for you:
Musical Signal Processing with LabVIEW
I would be interested in your progress, so don't hesitate to post some of your code
Regards,
Alex
11-19-2015 07:32 AM - edited 11-19-2015 07:33 AM
As Bob_Schor said, playing two notes together has NOTHING to do with averaging them.
It's called MIXING, and doesn't work like you're thinking.
If the tones are pure (sinusoidal), and if the mixer is perfectly linear, then the mixed result is simply a waveform with TWO frequencies in it.
But piano (or any other musical instrument besides a whistle) tones are NOT pure - they have harmonics, which are other frequencies, related (mathematically) to the fundamental.
And if your mixer is non-linear, then it will produce spurious frequencies: the SUM (F1+F2) and the DIFFERENCE(F1-F2) frequencies, and the sums and diffs of various harmonics, making a large ugly mess.
If you want to hear what two keys sound like together, just add the two waveforms. That's good enough for a first go.
You have to be careful about headroom, though - if you add a full loudness C and a full-loudness F, then there will be parts of the result that are clipped (that's a non-linear mixer right there), and it will sound like a broken speaker.
So, generally, if your individual tones are full loudness (+/- 1.0), then you want to divide them down by 8 or 10 before mixing, so as to avoid clipping. Then provide a master volume control to adjust the mixed output level.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
11-19-2015 07:54 PM
12-04-2015 08:38 PM
I build the first protoType, the way is using convolution.
Based on my tested, the result tone is not so much averaged.
( I choose toneA and toneC as my inputs, its wont exactly come out toneB but a fusion)
May be convultion is not best way for my purpose, but I was gain something new about that.
Anyway , thanks for you guys giving me guide , as promised I post my protoType here.