What i'm trying to achieve is playing a guitar chord from my python application. I know (or can calculate) the frequencies in the chord if needed.
I'm thinking that even if I do the low level leg work of producing multiple sine waves at the right frequencies it wont sound right due to the envelope needing to be correct also, else it wont sound like a guitar but more of a hum.
Tantilisingly, the linux sox command play can produce a pretty convincing individual note with:
play -n synth 0 pluck E3
So really what i'm asking is,
a) is it possible to shoehorn the play command to do a whole chord (ideally with slightly differing start times to simulate the plectrum string stroke) -- i've not been able to do this but maybe theres some bash fairydust that'll fork a process or such so it sounds right. If this is possible i'd settle for just calling out to a bash command from my code (I dont like reinventing the wheel).
b) (even better) is there a way in python of achieving this (a guitar chord sound) ? I've seen a few accessable python midi librarys but frankly midi isn't a good fit for the sound I want, as far as i can tell.
The manual gives this example:
play -n synth pl G2 pl B2 pl D3 pl G3 pl D4 pl G4 \
delay 0 .05 .1 .15 .2 .25 remix - fade 0 4 .1 norm -1
This creates 6 simultaneous instances of synth (as separate audio channels), delays 5 of the channels by slightly increasing times, then mixes them down to a single channel.
The result is a pretty convincing guitar chord; you can of course change the notes or the delays very easily. You can also play around with the sustain and tone of the 'guitar', or add an overdrive effect—see the manual for details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With