Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Mixing Frequencies

Name: Anonymous 2006-06-25 1:26

Hey, just for the hell of it I wrote a small program to play MIDI files over a PC speaker. Specifically a piezoelectric speaker that can only play a single frequency at a time (no PWM for me :/).

I'm still working on it but I have something that vaguely resembles the MIDI coming out of the speaker. 'Cept it only works on a single channel at a time because the piezo speaker can't play polyphonic sound (in PC's as far as I know).

Does anyone know a good method to combine frequencies to produce a good approximate sound. Given how people percieve pitch I was hoping somebody knew a function that woould combine frequencies to produce the best 'precieved average' or something of the sounds. That way I might be able to combine multiple channels to make a better sounding playback.

Posting here because its a program I'm writing and I figure the general knowledge level in here is higher than /music/.

Name: Anonymous 2006-06-25 1:49

Here's two ideas:
- Quickly switch between the frequencies. This probably sounds like shit once the frequency of switching becomes an audible tone itself. (10-20hz is probably an ok speed for less than 5 simultaneous notes)

- Mix the audio yourself, and then use the speaker to play a 1-bit representation of it (i.e. on when above zero, off when below zero). This will also sound like shit, if it even works with a piezo.

Name: Anonymous 2006-06-25 3:08

>>2
One idea I was thinking I could use, that would also allow me to play any music file, is to do a Fourier Tranform on samples of music and then take an average of the higher amplitude frequencies to get the average frequency. Unfortuantely, it's pretty far beyond what I know about mathematics so I can't quite figure it out. I've got FFTW library linking into a small application but I am having trouble using it since I don't know which tranforms (r2c, r2r?) to use and to format/interpret the input and output.

Name: Anonymous 2008-01-11 8:21

Name: Anonymous 2008-01-11 8:34

>>4
The main idea behind this driver is to switch the PC speaker on, then off before the speaker reaches the "top", thus making it acts like a "real" speaker. Unfortunately, it works very bad with a piezoelectric speaker and makes a shitty sound.

I remember FastTracker II using this trick to play 4+ channels modules on a PC speaker

Name: Anonymous 2008-01-11 8:45

>>3
it doesn't work like that. a human doesn't hear the average of the frequencies but the individual frequencies.

also, r2r is probably most appropriate if you don't need phase information.

Name: Anonymous 2008-01-11 9:29

Name: Anonymous 2008-01-11 17:03

Mix the frequencies by superposition.

Name: Anonymous 2008-01-11 17:30

Name: Anonymous 2009-02-25 6:42


Compiler course here and   its like all.

Name: Anonymous 2010-06-07 6:46

Hi, I can spam /prog/ too, you faggot.

Also, smoke weed everyday.

Name: Anonymous 2010-06-26 9:59

ur gay

Name: Anonymous 2010-12-25 11:14

Name: Sgt.Kabuܐkiman蒵鿢 2012-05-28 19:19

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

Don't change these.
Name: Email:
Entire Thread Thread List