Thanks JJC. I'll go ahead and use the adding method for now. If I ever see a need and get around to creating a mono output API I'll certainly offer it back to the maintainers in case they want to include it. All the best, Ien
On Thu, May 14, 2015 at 2:14 PM, CERESA Jean-Jacques ENAC/ENAC < jean-jacques.cer...@enac.fr> wrote: > > Is it very unusual to need mono output? > I don't know if anyone can say that it is usual or not to need mono output. > The fact is many music are recorded at least in stereo. This is why many > synthesizers follow this standard. > SoundFont 2.01 synthesiser model is based on mono or stereo sample. I am > not a Fluidsynth maintainer, but as far i known, > actualy, Fluidsynth produces always stereo samples on output even the > Soudfont samples are mono. > It is clear that the aim of FluidSynth is to comply to the SF 2.01 model. > It is clear also that FluidSynth is a good library to embed only the > necessary components in a custom application. > > There is no reason that applications are forced to used stereo in the case > of it need only mono sample. > In fact actually, there are 3 functions in the set of API rendering audio > these are: > 1)fluid_synth_write_s16() for one stereo channel (PCM samples). > 2) fluid_synth_write_float() for one stereo channel (float samples). > 3) fluid_synth_nwrite_float() for multiples stereo channels (float > samples). > > Alls are for stereo audio channels. Alls are actually used in audio > drivers so it is not a good idea to modify theses. But it is very easy to > add function to do the same things for mono channel. > If you are a developper, you can do this yourself for your need, and if > you think that it can be useful for others you > can ask the maintainer to add your work to the library. > > If you intend to build a new API rendering audio for mono sample this need > to be done in fluid_synth.c file. > If you think i can help you, ask me. > > jjc > > Le 14/05/15, *Ien Cheng *<i...@alum.mit.edu> a écrit : > > Ah yes hadn't even thought about that -- good point. > > Is it very unusual to need mono output? If it's a common need, maybe I'll > hack the API to provide a way to do it directly -- does the FluidSynth > project accept pull requests for things like this? > > --Ien > On May 14, 2015 10:57 AM, "CERESA Jean-Jacques ENAC/ENAC" < > jean-jacques.cer...@enac.fr> wrote: > >> Hi >> >Adding the two channels seems like the straightforward and more natural >> thing to do. >> >> Really, way 2 is the right way. Has you say,this is the more >> straightforward, because even if you choose the way 1, >> you solve your initial level problem, but you change the panoramic >> balance beetween voices (only in the case if your sound is made from >> more than 1 voice). In others word, with way 1 you risk breaking the work >> done by the soundfont sound designer !. >> >> All the best. >> >> jjc >> >> >> Le 14/05/15, *Ien Cheng *<i...@alum.mit.edu> a écrit : >> >> Thanks JJC - >> >> That's all very helpful! >> >> Adding the two channels seems like the straightforward and more natural >> thing to do. >> >> All the best, Ien >> >> On Thu, May 14, 2015 at 9:32 AM, CERESA Jean-Jacques ENAC/ENAC < >> jean-jacques.cer...@enac.fr> wrote: >> >>> Hi, >>> >>> >If this is the correct way to generate mono output ? >>> When any audio device (i.e the fluid_synth_write_s16() or another >>> device) supplies a stereo (left,right) signal, the right way to transfort >>> this signal in a mono signal with the same level is to sum left and right >>> part.: Mono signal = left + right >>> >>> >Could this explain why the volume is low? Because each channel is at >>> half volume? >>> Let a stereo signal with panoramic at 0 (i.e centered) (Left = 50% >>> level, Right= 50 % level). >>> If you overwrite left channel by right channel (or the reverse) you lost >>> 50% of the initial level >>> >>> Let a stereo signal with panoramic at -25 % . (Left = 75% level, Right= >>> 25 % level) >>> If you overwrite left channel by right channel you lost 75% of the level >>> !!! >>> >>> >what other reasons could there be for the volume to be low? >>> 1) Of course, the main gain must be at 1 to get a full level of the >>> soundfont sample used to synthesize your sound. >>> 2)To get a full stero level, not only Velocity must be full (127) >>> but also both MIDI CC Expression and Volume need to be full. Both have >>> correct initial default value (127 and 100). >>> >>> >If so, is there another way to general full-volume mono output? , >>> Here tow distincts ways: >>> 1)If you want to use your way (i.e. the right channel overwriting the >>> left channel), you can do this workaround: >>> Set a stereo signal with panoramic at +50 % . (Left = 0% level, >>> Right= 100 % level), for alls voices of the preset used to synthesize your >>> sound. >>> >>> 2)After calling fluid_synth_write_s16() , for each sample you can do: >>> left = left + right. >>> >>> Which do you prefer ? >>> >>> jjc >>> >>> Le 14/05/15, *Ien Cheng *<i...@alum.mit.edu> a écrit : >>> >>> Hi fluidsynth-dev: >>> >>> I've got fluidsynth working nicely in an Android app. What I'm doing is >>> using the fluid_synth_write_s16 API to generate PCM data that I feed into >>> Android's OpenSL ES audio system. >>> >>> However, I'm running into an odd problem where the volume level is low, >>> even with all MIDI velocities set to the max of 127. >>> >>> I wonder if this is due to the way I'm trying to generate mono output. >>> In the parameters to to fluid_synth_write_s16, I've set lout = rout, loff >>> and roff to both be 0, and lincr and rincr to both be 1 -- i.e. the right >>> channel is overwriting the left channel. >>> >>> Could this explain why the volume is low? Because each channel is at >>> half volume? >>> >>> If so, is there another way to general full-volume mono output? If this >>> is the correct way to generate mono output, what other reasons could there >>> be for the volume to be low? >>> >>> Thanks! >>> >>> --Ien >>> >>> p.s. Aere Greenway, if you are reading this, THANKS for your reply to my >>> question about SF2/DLS/iOS the other day -- I got the mailing list digest >>> and can't reply to your reply directly. >>> >>> >>> _______________________________________________ >>> fluid-dev mailing list >>> fluid-dev@nongnu.org >>> https://lists.nongnu.org/mailman/listinfo/fluid-dev >>> >>> >> >> _______________________________________________ >> fluid-dev mailing list >> fluid-dev@nongnu.org >> https://lists.nongnu.org/mailman/listinfo/fluid-dev >> >> > _______________________________________________ > fluid-dev mailing list > fluid-dev@nongnu.org > https://lists.nongnu.org/mailman/listinfo/fluid-dev > >
_______________________________________________ fluid-dev mailing list fluid-dev@nongnu.org https://lists.nongnu.org/mailman/listinfo/fluid-dev