[Top][All Lists]

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

Re: [fluid-dev] Trouble building/using fluidsynth

From: Justin
Subject: Re: [fluid-dev] Trouble building/using fluidsynth
Date: Mon, 24 Dec 2018 20:35:13 -0500

Cool, thanks! I've now set up a virtual EC2 instance locally on my mac, and complied fluidsynth, as you've suggested. I'm still having execution issues, though when I try to call the subprocess to run fluidsynth on the lambda as a subprocess of my python lambda function:

-ni: fluidsynth_exec/fluidsynth: /home/linuxbrew/.linuxbrew/lib/ld.so: bad ELF interpreter: No such file or directory
[INFO] 2018-12-24T21:13:45.687Z caf3eeba-07c0-11e9-b529-973f6e240519 In CatchAllExceptionHandler

[ERROR] 2018-12-24T21:13:45.687Z caf3eeba-07c0-11e9-b529-973f6e240519 Command '['fluidsynth_exec/fluidsynth', '-ni', 'fluidsynth_exec/sf.sf2', 'some_midi.mid', '-F', 'some_wav.wav', '-r', '44100']' returned non-zero exit status 126.
Traceback (most recent call last):
File "/var/task/ask_sdk_runtime/dispatch.py", line 118, in dispatch
output = self.__dispatch_request(handler_input)
File "/var/task/ask_sdk_runtime/dispatch.py", line 183, in __dispatch_request
handler_input=handler_input, handler=request_handler)
File "/var/task/ask_sdk_runtime/dispatch_components/request_components.py", line 433, in execute
return handler.handle(handler_input)
File "/var/task/lambda_function.py", line 229, in handle
test_file = TestScript().test_script()
File "/var/task/test_script.py", line 151, in get_file
subprocess.check_call(fluidsynth_command, shell=True)
File "/var/lang/lib/python3.7/subprocess.py", line 341, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['fluidsynth_exec/fluidsynth', '-ni', 'fluidsynth_exec/sf.sf2', 'some_midi.mid', '-F', 'some_wav.wav', '-r', '44100']' returned non-zero exit status 126.
END RequestId: caf3eeba-07c0-11e9-b529-973f6e240519

I think it's trying to use the file structure of my virtual machine I compiled it on, based on the "bad ELF" line referring to: "
/home/linuxbrew/.linuxbrew/lib/ld.so". I used LinuxBrew to install the dependencies for fluidsynth that you mentioned above (libsndfile, etc).
I tried copying the "ld.so" file over from the VM and sticking it in the fluidsynth_exec folder, but that failed with the same error. I also attempted to compile fluidsynth statically linked by running on the VM: 
make SHARED=0 CC='gcc -static'
but using the executable made from this (in the src folder) failed as well in the same way. I don't think that my attempt to compile the executable as statically-linked actually did anything different, since the binary that was produced was 53kb, just like the original.
Do you have any ideas what I could do differently? Unsure exactly why my attempts have failed.
Thanks so much!

On Mon, Dec 24, 2018 at 4:53 AM Marcus Weseloh <address@hidden> wrote:

The easiest might be to skip cross compiling and build it natively. So either on an AWS instance, or on a virtual machine on your Mac. On the VM, just install the built-essential libsndfile-dev, libglib-dev and cmake packages (or whatever they are called on the distro you are using), build it and then copy the compiled executive, libfluidsynth.so* and libsndfile.so* to your AWS.


Am Mo., 24. Dez. 2018, 06:54 hat Justin <address@hidden> geschrieben:
Thanks for the quick reply! Installing the dependencies via homebrew fixed my issue, and fluidsynth can now do the conversion for me locally!
However, I'm facing another issue now, which probably comes from the fact that I compiled the code on my mac, and I'm trying to run it on AWS lambda (which I think runs Amazon Linux):

File "/var/lang/lib/python3.7/subprocess.py", line 1516, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: 'fluidsynth_exec/fluidsynth'

The (python) code which raises this error is as follows:

fluidsynth_command = ['fluidsynth_exec/fluidsynth', '-ni', tmp_sf2_file_name, tmp_mid_file_name, '-F', tmp_wav_file_name, '-r', '44100']

This code works locally for me, so I guess I need to cross-compile fluidsynth to work on AWS lambda. Do you have any experience with this? Unfortunately, most of the literature I'm finding on cmake and cross-compilation seems really opaque, and I can't even find anything that mentions how to make it work for Amazon Linux. I'm especially uncertain about doing this cross compilation, since it'll need to rely on libsndfile, which presumably is built for mac osx on my machine.

On Sun, Dec 23, 2018 at 7:09 PM Marcus Weseloh <address@hidden> wrote:
Hi Justin,

you probably compiled Fluidsynth without libsndfile support, so the resulting audio is a raw 16-bit signed dual-channel float audio file (so not a .wav file with proper headers). You can either convert this raw file to wav using some tool, or install libsndfile-dev (or whatever it's called in your distribution) before building fluidsynth.



Am So., 23. Dez. 2018 um 23:34 Uhr schrieb Justin <address@hidden>:
Hello, I'm trying to compile a fluidsynth binary. For my application, I need a way to convert from midi to mp3 on an AWS lambda, and I thought that using fluidsynth would be the best way. These are the steps I took:

  1. Clone fluidsynth from here: https://github.com/FluidSynth/fluidsynth
  2. Created build directory and ran 'cmake ..' from build directory
  3. Ran 'make fluidsynth' from build directory. This seemed to create a binary file called 'fluidsynth' in build/src directory
  4. Downloaded a sound font file from https://github.com/urish/cinto/blob/master/media/FluidR3%20GM.sf2 (renamed to sf.sf2 for convenience

Running the binary gave the following output:

fluidsynth -ni sf.sf2 some_midi.mid -F output.wav -r 44100

FluidSynth runtime version 2.0.2

Copyright (C) 2000-2018 Peter Hanappe and others.

Distributed under the LGPL license.

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

Rendering audio to file 'output.wav'..

However, when I tried to play the output.wav file that was generated, it just gave a short loud click/pop.

I'm not sure what I'm doing wrong. Could someone give me some advice for how to figure out how to get this working? Or is there a better way for me to get fluidsynth to work on AWS lambda?



fluid-dev mailing list
fluid-dev mailing list
fluid-dev mailing list
fluid-dev mailing list

reply via email to

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