fluid-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [fluid-dev] Distorted Sound with FluidSynth + Alsa on a SBC


From: Philippe Simons
Subject: Re: [fluid-dev] Distorted Sound with FluidSynth + Alsa on a SBC
Date: Wed, 20 Nov 2019 01:23:03 +0100

Also, if you are building from sources... make sure to compile a RELEASE build :p

On Wed, Nov 20, 2019 at 12:24 AM Etienne Besançon <address@hidden> wrote:

Dear Jean-Jacques,

 

Thank you for your tips.

 

I just discovered the settings (-o) and its pretty impressive!

 

My issue is actually fixed: the default audio.period-size parameter (64) was too low. 128 was still to low, 256 gave a perfect sound! The whole synthesizer sounds very reactive, no latency to my ears.

 

Just for my own satisfaction, I could not find who is the default audio.alsa.device. The help output tells me that it is "default". Aplay lists what follows:

 

odrodroid@odroid:~$ aplay -L

null

    Discard all samples (playback) or generate zero samples (capture)

pulse

    PulseAudio Sound Server

sysdefault:CARD=ODROIDHDMI

    ODROID-HDMI, 

    Default Audio Device

dmix:CARD=ODROIDHDMI,DEV=0

    ODROID-HDMI, 

    Direct sample mixing device

dsnoop:CARD=ODROIDHDMI,DEV=0

    ODROID-HDMI, 

    Direct sample snooping device

hw:CARD=ODROIDHDMI,DEV=0

    ODROID-HDMI, 

    Direct hardware device without any conversions

plughw:CARD=ODROIDHDMI,DEV=0

    ODROID-HDMI, 

    Hardware device with all software conversions

sysdefault:CARD=ODROIDDAC

    ODROID-DAC, 

    Default Audio Device

dmix:CARD=ODROIDDAC,DEV=0

    ODROID-DAC, 

    Direct sample mixing device

dsnoop:CARD=ODROIDDAC,DEV=0

    ODROID-DAC, 

    Direct sample snooping device

hw:CARD=ODROIDDAC,DEV=0

    ODROID-DAC, 

    Direct hardware device without any conversions

plughw:CARD=ODROIDDAC,DEV=0

    ODROID-DAC, 

    Hardware device with all software conversions

sysdefault:CARD=Micro

    Default Audio Device

 

But "-a alsa -o audio.alsa.device=plughw:0" or "hw:0" do not give any kind of sound (perfect mute). dmix/dsnoop fail to open.

 

Again, thank you all for taking care of this.

HLB

 

 

> Message du 19/11/19 19:17
> De : "Ceresa Jean-Jacques" <address@hidden>
> A : "EtienneBesançon" <address@hidden>, "FluidSynthmailinglist" <address@hidden>
> Copie à :
> Objet : Re: [fluid-dev] Distorted Sound with FluidSynth + Alsa on a SBC
>
>

> Hi Etienne,

> > odroid@odroid:~$ fluidsynth -C0 -R0 -r 44100 -c2 -v -d -a alsa -m alsa_seq /home/odroid/Documents/bandoneon_v2.sf2

> Here some tips. Those result on experimention using Raspberry device.

> 1) Avoiding lost of precious cpu cycles:

> 1.1) Setting reverb and chorus off: Use -C0 -R0.

> 1.1) Never use -v and -d option permanently. Both consume a lot of precious cpu cycles.

> 2) Allowing fluidsynth sufficient time to compute things:

> 2.1) Prefer low sample rate: 44100Hz (avoid 96000Hz):

> 2.2)Avoid -c2 option and prefer -o audio.periods=xx , also use  -o audio.period-size=yy to choose the size of each buffer.

> First use Alsa driver before trying using Alsa hardware device layer.

> Play one note using "noteon" command before trying playing note from your MIDI controller.

> The first thing to do is choosing high value for xx and yy.Then when a one note sounds fine you could try to diminish xx, yy to

> get lower latency as possible.

>  

> Have you solved your issue ?

> What settings did you use when you got a distorded sound ?

> jjc.

>  

> Message du 15/11/19 18:57
> De : "Etienne Besançon" <address@hidden>
> A : address@hidden
> Copie à :
> Objet : Re: [fluid-dev] Distorted Sound with FluidSynth + Alsa on a SBC
>
>

> > Thanks for reactivity,

> >  

> > Pulse audio is now uninstalled.

> >  

> > I was able to get sound from Alsa:

> >  

> > odroid@odroid:~$ aplay -l

> > **** List of PLAYBACK Hardware Devices ****

> > card 0: ODROIDHDMI [ODROID-HDMI], device 0: SPDIF PCM dit-hifi-0 []

> >   Subdevices: 1/1

> >   Subdevice #0: subdevice #0

> > card 1: ODROIDDAC [ODROID-DAC], device 0: PCM5102 HiFi pcm5102-0 []

> >   Subdevices: 1/1

> >   Subdevice #0: subdevice #0

> >  

> > odroid@odroid:~$ aplay -D hw:CARD=ODROIDDAC,DEV=0 Desktop/foo.wav 

> > Playing WAVE 'Desktop/foo.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

> > ^CAborted by signal Interrupt...

> >  

> > Fluidsynth gets right rate:

> >  

> > odroid@odroid:~$ fluidsynth -C0 -R0 -r 44100 -c2 -v -d -a alsa -m alsa_seq /home/odroid/Documents/bandoneon_v2.sf2

 

> > Changing the rate has an expected impact: even distorted, switching from 48000 to 96000 will increase the notes of one octave.

> > I also try to change the soundfont without improvement.

> >  

> > Indeed, the CPU is a 32-bits Cortex-A5…

> >  

> > HLB

> >  

> >  

> >  

> >  

> Message du 15/11/19 10:26
> De : "Philippe Simons" <address@hidden>
> A : "FluidSynth mailing list" <address@hidden>
> Copie à : "Etienne Besançon" <address@hidden>
> Objet : Re: [fluid-dev] Distorted Sound with FluidSynth + Alsa on a SBC
>
>
device seems to be powerful enough.
maybe you can also try to disable 64bit floating point operations and use 32bit with cmake enable-floats options
also if you are not using pulse at all, try to disable it completely

>
Philippe

>
On Fri, Nov 15, 2019 at 9:34 AM Marcus Weseloh <address@hidden> wrote:
>
Hi Etienne,

>
first please try to find out if Fluidsynth is actually the problem or if there is something wrong with your audio setup. Maybe try to play a normal wav file via the alsa device:

>
$ aplay -D hw:1,0 /path/to/a/soundfile.wav

>
For the sound file, use one in the format that you want fluidsynth to output. So if you want it to render 16bit 441000 audio, then try to play a stereo wav with 16 bit and 41000 sample rate. 
See if simply playing the wav file also results in distorted audio.

>
Cheers
Marcus

>

>
Am Do., 14. Nov. 2019 um 22:17 Uhr schrieb Etienne Besançon <address@hidden>:
>

> > > Hi!

> > >  

> > > I'm running FluidSynth on a Single Board Computer, a Hardkernel Odroid C1+ that is actually stacked with a audio board integrating a high-end DAC. The aim is to turn this into a MIDI expander. Long story short, that actually runs pretty good on my desktop computer but got a very distorted sound on the SBC.

> > >  

> > > The MIDI instrument is well discovered:

> > >     odroid@odroid:~$ lsusb 

> > >     Bus 001 Device 005: ID 2341:8037 Arduino SA 

> > >  

> > > Fluidsynth is configured as follow:

> > >     odroid@odroid:~$ fluidsynth -C0 -R0 -r 44100 -v -d -a alsa -o audio.alsa.device=hw:1 -o synth.polyphony=64 -m alsa_seq /home/odroid/Documents/Bandoneon.sf2 

> > >     FluidSynth version 1.1.6

> > >     Copyright (C) 2000-2012 Peter Hanappe and others.

> > >     Distributed under the LGPL license.

> > >     SoundFont(R) is a registered trademark of E-mu Systems, Inc.

> > >     

> > >     fluidsynth: warning: Failed to pin the sample data to RAM; swapping is possible.

> > >     fluidsynth: prog 0 0 0

> > >     fluidsynth: prog 1 0 0

> > >     fluidsynth: prog 2 0 0

> > >     fluidsynth: prog 3 0 0

> > >     fluidsynth: prog 4 0 0

> > >     fluidsynth: prog 5 0 0

> > >     fluidsynth: prog 6 0 0

> > >     fluidsynth: prog 7 0 0

> > >     fluidsynth: prog 8 0 0

> > >     fluidsynth: prog 9 128 0

> > >     fluidsynth: warning: No preset found on channel 9 [bank=128 prog=0]

> > >     fluidsynth: prog 10 0 0

> > >     fluidsynth: prog 11 0 0

> > >     fluidsynth: prog 12 0 0

> > >     fluidsynth: prog 13 0 0

> > >     fluidsynth: prog 14 0 0

> > >     fluidsynth: prog 15 0 0

> > >     Type 'help' for help topics.

> > >     

> > >     event_pre_noteon 0 60 106

> > >     event_post_noteon 0 60 106

> > >     fluidsynth: noteon 0 60 106 00000 36.312 3.550 0.000 0

> > >     event_pre_noteoff 0 60 106

> > >     event_post_noteoff 0 60 106

> > >     fluidsynth: noteoff 0 60 0 00000 3.574 1

> > >     event_pre_noteon 0 60 106

> > >     event_post_noteon 0 60 106

> > >     fluidsynth: noteon 0 60 106 00001 39.626 3.876 0.000 0

> > >     event_pre_noteoff 0 60 106

> > >     ^C

> > >  

> > > The instrument well connected:

> > >     odroid@odroid:~$ aconnect -io

> > >     client 0: 'System' [type=kernel]

> > >         0 'Timer           '

> > >         1 'Announce        '

> > >     client 24: 'Arduino Micro' [type=kernel]

> > >         0 'Arduino Micro MIDI 1'

> > >     client 128: 'FLUID Synth (3113)' [type=user]

> > >         0 'Synth input port (3113:0)'

> > >     odroid@odroid:~$ aconnect 24 128

> > >  

> > > Well, everything looks fine but the sound I get when playing the midi instrument is very distorted, noisy. Changing the rate did not improved, playing with the buffer a little bit. Weirdly enough, switching output to pulse audio ("fluidsynth -a pulseaudio...") gives expected sounds but with a 2~3 seconds latency.

> > >  

> > > Any clue about this? How can I get more details regarding what going on?

> > >  

> > > Thanks!

> > > HLB

> > >  

_______________________________________________
> fluid-dev mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/fluid-dev
>
_______________________________________________
> fluid-dev mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/fluid-dev
>



_______________________________________________
fluid-dev mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/fluid-dev

_______________________________________________
fluid-dev mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/fluid-dev

reply via email to

[Prev in Thread] Current Thread [Next in Thread]