Code Monkey home page Code Monkey logo

samplerbox's Introduction

SamplerBox

Update: Remove drums from song with the VST DrumExtract!

 

SamplerBox is an open-source DIY audio sampler project based on RaspberryPi.

Website: www.samplerbox.org

Install

SamplerBox works with the RaspberryPi's built-in soundcard, but it is recommended to use a USB DAC (PCM2704 USB DAC for less than 10€ on eBay is fine) for better sound quality.

You can use a ready-to-use ISO image from the Releases page or do a manual install:

  1. Start with a standard RaspiOS intsall. The following steps have been tested with 2021-05-07-raspios-buster-armhf-lite.zip.

  2. Install the required dependencies (Python-related packages and audio libraries - the current version requires at least Python 3.7):

    sudo apt update
    sudo apt -y install git python3-pip python3-smbus python3-numpy libportaudio2 
    sudo apt -y install raspberrypi-kernel  # quite long to install, do it only if necessary, it solves a "no sound before 25 second on boot" problem
    sudo pip3 install cython rtmidi-python cffi sounddevice pyserial
    
  3. Download SamplerBox and build it with:

    git clone https://github.com/josephernest/SamplerBox.git
    cd SamplerBox
    sudo python3 setup.py build_ext --inplace
    
  4. Reboot the Pi, and run the soft with:

    sudo python3 samplerbox.py
    

    Play some notes on the connected MIDI keyboard, you'll hear some sound!

  5. (Optional) Modify config.py if you want to change root directory for sample-sets, default soundcard, etc.

How to use it

See the FAQ on https://www.samplerbox.org.

Notes

A few remarks:

  • the current version works on Pi 2, 3, 4 (re-tested on Pi2 & Pi4 on 2022-08-09)
  • the current version also works on Windows if all the required modules are installed
  • MIDI via GPIO/serial should be re-tested with the current version, see #49
  • 7-segment display confirmed working as of 2022-08-09, see requirement

ISO image

The ready-to-use ISO images available on www.samplerbox.org are built with the help of a script that can be found in isoimage/maker.sh.

About

Author : Joseph Ernest (twitter: @JosephErnest, mail: [email protected])

Sponsors and consulting

I am available for Python, Data science, ML, Automation consulting. Please contact me on https://afewthingz.com for freelancing requests.

Do you want to support the development of my open-source projects? Please contact me!

I am currently sponsored by CodeSigningStore.com. Thank you to them for providing a DigiCert Code Signing Certificate and supporting open source software.

License

Creative Commons BY-SA 3.0

samplerbox's People

Contributors

achilleusd avatar josephernest avatar mgeier avatar mojca avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

samplerbox's Issues

Crackling (also with external sound card)

My Raspberry Pi 2 B arrived yesterday, which I bought with the intention of using SamplerBox with it. I loaded a bunch of samples on it and was really stoked to hear the sounds coming out of a tiny computer running a python script! I commend you on your awesome work so far!

The issue: I found that playing three of more samples at once often results in a hard crackling sound that sounds like clipping. This makes it pretty much to play the sampler like a piano as I'm planning to (I have a Nord synth without piano sounds that I'm hoping to supplement with the SamplerBox).

I am using a cheap mini USB audio interface. I don't think it's quite as high-quality as the DAC you recommend, but I have used it for DJing with Traktor in the past without issue, so I don't think it's that.

I'm assuming this really is clipping. Any ideas how we can prevent this, presumably with a compressor / limiter setup? I will test this over the weekend by turning down the master volume. This isn't really a long-term solution though (it should be able to keep up with the Nord volume level to at least a reasonable degree).

I found a basic limiter written in C with Python bindings but beyond that there seems to be amazingly little available in the open source community. Am I missing something, I mean is this built into ALSA or JACK or something and I just don't know about it?

Suupport for redtide/ConvertWithMoss

redtide/ConvertWithMoss enables conversion between a wide variety of sample libraries, my goal is to convert DecentSampler/PianoBook sample collections into a format compatible with SamplerBox. I tried just using the wav files provided with a decent sampler patch , but they seem to include a bunch of silence at the beginning so it seems that to be more widely compatible with sample sets, I would have to modify SamplerBox to be able to support a very large set of custom attributes per-patch such as sample-start-time, loop points, and a seemingly unending list of potential attributes that would quickly exhaust the constraints of extracting such data via filename.

So, I propose, instead that we expand the instructions in the FAQ for the SamplerBox's sample format, to make implicit assumptions more explicit. Does each sample presume the sample starts at the transient? How are loop points handled? What about envelopes? Should the samples be normalized to a specific db-range?

Can we get some clarification on sampler-box's requirements to make more sample libraries compatible?

[FEATURE REQUEST] - Use midi files as midi in

Simon posted yesterday, 21:46:
http://www.samplerbox.org/forum/141

Is there a way to use a midi file as input ?

I was so entrained by this project that i bougth everything and assabled it without even thinking about the need of a midi device to give the box some input.
In about three weeks i'll have plenty midi devices to play with but i dont want to wait :)

Thanks in advance!

Nothing Happening

When I put the .IMG file onto my sd card, then put it in my RPI 2, I plugged it in, but nothing happened. My keyboard didn't turn on when plugged in through USB, but my speaker had a faint static-like sound.
I am not using the full setup, just with my midi keyboard over USB.
Can you help with this?

Thanks, Samuel

New Feature: jack support

A great thing for amplerbox would be to add jack support.

This feature would open easy integration with any other jack supported applications, for instance, sooperlooper (to make some live loops)

An API exists: http://www.jackaudio.org/api/

Bravo for this project that definitely rocks ;-)

Support for mp3, flac, ogg, etc?

Some of the sample files available for some of the better patches take up a lot of memory. How hard would it be to add support for ogg, flac, and/or mp3?

Some experience - r/w remount problem, usb audio, octave shifted, latency

Some experience:

-sometimes I cant remounted r/w the file system (when I modified files on sd card, with an other pc) : mount -o remount,rw / mount -> can't find / in /etc/fstab

solution:

mount /dev/mmcblk0p1 /boot
mount -o remount,rw /dev/mmcblk0p2 /

  • I use usb audio, but not working.

Solution:

touch /etc/asound.conf
and write into 2 lines:

defaults.pcm.card 1
defaults.ctl.card 1

(and into samplerbox.py: AUDIO_DEVICE_ID = 2)

  • when I played with piano preset, the octave was shifted.
    Solution (SamplerBox.py):

def MidiCallback..:

midinote = note + 12

  • I experimented with buffer (to lower latency)
    It seems to lower:

in the open audio section (try-except): blocksize=0 (instead of 512, 128, 32 etc)

But there is still a lot of latency. I think 20-30 ms. Especially when I played piano preset. It has fast attack, and I feel the latency, and it disturb me a bit. Whit the slow attack preset (like slow string, chello etc) it isn't annoying.

Have someone ever try any real-time kernel, or very small and easy raspbian image for faster system? If you have any idea, please write. Thanks.

[FORK] %%velocitysensitivity in definitions.txt

Pavel posted Feb 2, 05:18:
http://www.samplerbox.org/forum/23

I have implemented %%velocitysensitivity option for patches to change volume depending on velocity
https://github.com/paul-at/SamplerBox/tree/velocity-sensitive

Install

git clone https://github.com/paul-at/SamplerBox/tree/velocity-sensitive
cd SamplerBox; make

Instructions

Add %%velocitysensitivity=1 to definition.txt in patch directory. If it does not exist already, create following:
%midinote.wav
%%velocitysensitivity=1

Python3 Support

Hi,

With python 2 being officially deprecated, are there any plans to update this to Python 3? Python 3 should also give more speed and stability.

Thanks

Not Working - "ImportError: No module named sounddevice"

Hey y'all,

I'm having some trouble getting SamplerBox to work on my Raspberry Pi 3, running Raspbian. I am using an Arturia MiniLab Mk II, connected to the Pi via USB. I did not build the circuit or the enclosure - I am just trying to use the software for the time being.

I followed the instructions from the README under the Install section by pasting each line into the terminal on my Pi.

After the line sudo pip install rtmidi-python pyaudio cffi sounddevice, a couple .tar.gz files were successfully downloaded, but then it said "collecting cffi" and then in red listed lines and lines of exceptions. At the end of that output, it says, again in red TypeError: unsupported operand type(s) for -=: 'Retry' and 'int

The next command seemed to go successfully.

After entering python samplerbox.py, I receive this output:
Traceback (most recent call last): File "samplerbox.py", line 35, in <module> import sounddevice ImportError: No module named sounddevice
I'm not sure if I followed the instructions incorrectly, or what the problem might be. I'm a total newbie to Raspberry Pi and the Linux ecosystem, so I wouldn't be surprised if I made a mistake that would be obvious to folks with more experience. Any help is greatly appreciated!

Thanks for making awesome software!

Sample never ends or lasts too much time

Sometimes, when i play default 0 saw files, it never ends. I need to restart my roland module.
It may happen as well that the sample lasts more than expected.
And some other times, it works fine.

my config: rpi3, jessie dist with manual installation of the paul's implmentation (i need to run another appli on it), usb/midi convertissor, roland td6 module

Any idea?
Cheers
ps: i have noticed a lot of midi messages sent by the module (maybe clock messages) regularly

Raspberry Pi 3 - Image doesn't works

Dorgangrinder posted Mar 24, 13:11:
http://www.samplerbox.org/forum/133

Martin posted Apr 7, 19:47:

Hey all, further to my original post I decided to give it a shot myself. I can confirm the image doesn't work on rpi3, but installing it manually does.
There are various changes you'll need to make to the samplerbox.py in order to get it working though.

  • For example, the /media mount isn't automatically created
  • the display() function is referencing a dependency that doesn't exist (though I did install all dependencies stated in the git repo) and the
  • samplerbox obviously won't automatically start.

If anyone wants more info, please let me know.

Jerome posted Apr 16, 12:02:

  • boot-delay passed from 0 to 1 (config.txt) => no change
  • replaced the kernel image with a recent one directly in boot partition => no change
  • I replace also the file star.elf in the boot partition : booting !

But, I am always stuck without any sound produced due to some configuration error...

little app to add sample markers to your wave files

Hi,
As I was strugling to add sample marker to my wave files, and I don't want to buy sound forge only for this I wrote this little code to add sample marker to a wave file.
It's very basic but it can be useful.
I'm new to github so I don't know if I should pull it or something so here is the code :

`######## ---- samplemarker.py ----
######## THIS IS A SUPER BASIC CODE TO ADD SAMPLER MARKERS
######## TO ADD LOOP TO WAVE FILES THAT YOU WOULD LIKE TO USE
######## WITH SAMPLERS LIKE SAMPLERBOX

Let me know if you found some other way to do the same thing

Florent Jean Gaston

import struct
import binascii

print "welcome here buddy"
print "##################"
print "so you want to add sampler markers to a wave file ?"
print ""
print ""

my_file = raw_input("What's the name of your file ?")
print my_file

with open(my_file, 'rb+') as f:
#for i in range (4, 7) :
f.seek(4)
data = f.read(4)
data = struct.unpack("<L",data)
data = int(data[0])
print "Your file : "+my_file
print "File size : "+str(data)+" bytes"

print " "
start_loop = input("First sample of the loop ? ")

end_loop = input("Last sample of the loop ? ")

sure = raw_input("Are you really sure that you want to proceed (y/n) ? ") 
if sure == "n":
    print "abord mission ..."
    quit()
else:
    print "proceeding ..."
    

data = data+68 #ajoute 68 bytes au fichier

#print data

data = struct.pack("<L",data)
#print data
f.seek(4)
f.write(data)
f.close

with open(my_file, 'a+') as f:

smplmarker = '736D706C3C0000000000000000000000000000003C00000000000000000000000000000001000000000000000000000000000000'
smplmarker = binascii.unhexlify(smplmarker)
#print smplmarker
f.write(smplmarker)
start_loop = struct.pack("<L",start_loop)
f.write(start_loop)
end_loop = struct.pack("<L",end_loop)
f.write(end_loop)
endmarker = '0000000000000300'
endmarker = binascii.unhexlify(endmarker)
f.write(endmarker)
f.close

print 'Done !!!'

`  

Midi - Channel - using only one channel in Samplerbox

How can i modify the code below, for using only one midi-channel instead of omni-mode (all channel) input...?

def MidiCallback(message, time_stamp):
global playingnotes, sustain, sustainplayingnotes
global preset
messagetype = message[0] >> 4
messagechannel = (message[0] & 15) + 1
note = message[1] if len(message) > 1 else None
midinote = note
velocity = message[2] if len(message) > 2 else None

DAC link broken

The link to the 6€ DAC on eBay is broken.

Maybe a link to something more stable than eBay and a note telling the reader one can find them on eBay for ~6€.

Velocity question

Hello

I do not understand ,if i made 4 layers of Velocity record ( 10,40,70,127 )for example
If the midi message comes with Velocity value of (35) what sample will be played the 10 or 40 vel ?

thanks

Last Python2 release

@mojca I suggest we make a last Python2 ISO release to make sure everything works for people still using this good old version, and then we can move 100% to Python3 version. Todo:

Then we can add features in python3 branch and after some time, make this branch the default one.

error message when AUDIO DEVICE ID is wrong

Instead of the python audio error, it would be better to output a comprehensive error message with a list of audio devices

For example:

try:
    stream = p.open(format = pyaudio.paInt16, channels = 2, rate = 44100, frames_per_buffer = 512, output = True, input = False, output_device_index = AUDIO_DEVICE_ID, stream_callback = AudioCallback)
    print 'Opened audio: '+ p.get_device_info_by_index(AUDIO_DEVICE_ID)['name']
except:
    print "Invalid Audio Device ID: " + str(AUDIO_DEVICE_ID)
    print " "
    print "Here is a list of audio devices:"
    for i in range(p.get_device_count()):
        dev = p.get_device_info_by_index(i)
        # Remove input device (not really useful on a Raspberry Pi)
        if dev['maxOutputChannels'] > 0:
            print str(i) + " -- " + dev['name']
    exit(1)

GPIO ports

Hello,

First of all, thank you for this project. It is quite fun to use.
I'm looking into building the box, specially because my MIDI controller is a bit buggy regarding presets. Do you happen to have a GPIO mapping for the buttons? I saw the wiring, but I just want to double check.

Thank you !

Timed sustain

(This is mostly a reminder for me)

I needed some sustain for the piano but if I use sustain=True there was too much sustain.
You can however have more or less sustain by tweaking FADEOUTLENGTH.

Feature : Samba access

I like to use samba to simplify the creation of samples, I can upload wav files directly and reload them without restarting my Raspberry Pi

As Samba won't work in a read-only filesystem, and since I need it only when i'm making samples.
i remove it from boot.

Here is the procedure

mount -o remount,rw /
apt-get update;apt-get upgrade
apt-get install samba

Create password for root

smbpasswd

Modify /etc/samba/smb.conf

======================= Global Settings =======================
[global]
        dns proxy = no
        workgroup = WORKGROUP
        os level = 20
        syslog = 0
        panic action = /usr/share/samba/panic-action %d
        max log size = 1000

        #Unsecure mode
        security = user
        browseable = yes
        writeable = yes
        guest ok = yes

        load printers = no
        printing = bsd
        printcap name = /dev/null
        disable spoolss = yes

#======================= Name =========================
        #Name of your Raspberry Pi
        netbios name = synth
#======================= Shares =======================
[usb]
        # Path / User
        path = /media
        force user = root

Restart samba

/etc/init.d/samba restart

Check if you have access to \synth\usb

Remove it from boot

update-rc.d -f smbd remove
update-rc.d -f nmbd remove

How to use it

mount -o remount,rw /
/etc/init.d/samba start

User :root
Password: root

150ms latency: normal?

Hi, I'm using original soundcard with RPi 3 model B.
I have a huge ~150 ms latency, is it something expected with Samplerbox and my modest configuration?
Or is there something wrong on my side?
Thanks a lot

Invalid audio device #2

I've downloaded SamplerBox to my Raspberry Pi 4. After running python samplerbox.py, I get Invalid audio device #2. How do I fix this?

Random (rare) issues with alsa library

Occasionally, usually when pressing way too many keys on the keyboard, I run into the following error which makes it impossible to recover. Sometimes restarting the python app helps, sometimes I need to reboot the PI. I don't know whether anything can actually be done from within the SamplerBox project though, esp. because I haven't yet found a fully reliable way to reproduce the problem.

Expression 'alsa_snd_pcm_start( stream->playback.pcm )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2925
Expression 'AlsaStart( stream, 0 )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 3246
Expression 'AlsaRestart( self )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 3313
Expression 'PaAlsaStream_HandleXrun( self )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 4182
Expression 'PaAlsaStream_SetUpBuffers( stream, &framesGot, &xrun )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 4355

New pi (2019) fails to boot

Hi Joseph,

SamplerBox is a wonderful creation. Thank you for making and sharing!

I think that samplerbox_20170710 fails to boot in my 2019 Rpi because (I'm guessing) it's built on an OS that is now incompatible with the latest Raspberry Pi (which has some hardware change).

Please can you rebuild the load-and-go download using the latest OS? I'm sure that there will be many people who will be very grateful and it's a shame for this excellent project to not have a much longer life.

Thanks!

John

stuck at samplerbox login:

Hey there!
I went with Recommended install - written image on a microSD - as usual with Jessie
But somehow it wont auto start - all i can see after boot is

Raspbian Linux 8 samplerbox tty1
samplerbox login:

And thats it
What should i do?
Don't have keyboard now, and SSH won't work

ModuleNotFoundError: No module named 'sounddevice'

Hi,

Trying this line of code on jupyter notebook:

import sounddevice as sd

Getting the following error:

ModuleNotFoundError: No module named 'sounddevice'

Have tried:

pip install sounddevice
conda install -c conda-forge python-sounddevice
brew install portaudio
brew reinstall portaudio
pip install setuptools --user
pip install cffi --user
sudo pip install rtmidi-python pyaudio cffi sounddevice
pip install --upgrade pip
python3 -m pip install sounddevice

Does anyone know what might be wrong?
Thank you in advance!

Question about audio quality with usb audio card

In documentation and discussion it is made clear that one should not expect good audio quality without a sound card. This is obvious as soon as you try to play ~4-6 notes at once, you get the clicking static. With a sound card the clicking static happens, but it doesn't show up until you are repeating 8 note chords with sustain pedal. Is this as good as it gets?

Serial midi on recent images

Cuki posted Jan 18, 22:02:

I confirm what was also observed by r.meurer (posted Nov 17, 16:53:) and jpg (posted Jan 8, 23:04:) on the samplerbox forum

I could make serial MIDI work with samplerbox_20150618.img on RPI 2B

I could NOT make serial MIDI work with samplerbox_20161228.img on RPI 2B or RPI 3

Using USB-Midi interface and Akai LPK25 works with samplerbox_20161228.img on RPI 2B and RPI 3.

note: RPI 3 problem is probably due to the fact that bluetooth takes the full serial port that was available in RPI2. For RPI2 problem I have no explanation.

[FORK] Windows Version

remi posted Jun 9, 15:41:
http://www.samplerbox.org/forum/9

Windows version:
https://www.dropbox.com/s/2r2cetkqeg7qy8p/portableSamplerBox.rar?dl=0

  • Instructions:
    • Install python 2.7
      https://www.python.org/downloads/
    • Extract portableSamplerBox anywhere on your computer
    • Launch getaudioid.bat
      It will display your audio id, get the one you want.
    • Modify samplerBox\samplerBox\samplerbox.py
      AUDIO_DEVICE_ID = 3 with your audio ID
    • Launch samplerBox.bat
      All the samples must be put inside media (you can modify this inside samplerbox.py)

Feature Request: Randomise sample

Hi,

I'm using sampler box to trigger drum sounds from my electronic drum kit. The sample sets I am using (acoustic drum kits) have 3 hits for each drum / cymbal, each hit is the same velocity but varies in tone slightly and helps make the kit sound more natural and less like a drum machine.

Could there be a way to have 3 .wav files for the same note that randomise?

Thanks for the great software by the way.

Use sounddevice with nickyspride.nl version

If you want to use sounddevice instead of pyaudio with nickyspride.nl version

replace pyaudio with sounddevice

import sounddevice

Change in AudioCallback

#########################################
# AUDIO CALLBACK
#########################################

def AudioCallback(outdata, frame_count, time_info, status):
    global playingsounds, SampleLoading
    global BackingRunning
    global BackWav, BackIndex, ClickWav, ClickIndex
    global globalvolume, backvolume, clickvolume
    rmlist = []
    # print "sounds: " +str(len(playingsounds)) + " notes: " + str(len(playingnotes)) + " sust: " + str(len(sustainplayingnotes))
    playingsounds = playingsounds[-MAX_POLYPHONY:]
    b = samplerbox_audio.mixaudiobuffers(playingsounds, rmlist, frame_count, FADEOUT, FADEOUTLENGTH, SPEED)

    for e in rmlist:
        try:
            playingsounds.remove(e)
        except:
            pass

    # b *= globalvolume

    if USE_FREEVERB:
        b_temp = b
        freeverbprocess(b_temp.ctypes.data_as(c_float_p), b.ctypes.data_as(c_float_p), frame_count)

    # IF USE_TONECONTOL
    #   b = numpy.array(chain.filter(bb))
    #   b=bb

    if CHANNELS == 4:  # 4 channel playback
        # if backingtrack running: add in the audio
        if BackingRunning:
            BackData = BackWav[BackIndex:BackIndex+2*frame_count]
            ClickData = ClickWav[ClickIndex:ClickIndex+2*frame_count]
            BackIndex += 2*frame_count
            ClickIndex += 2*frame_count
            if len(b) != len(BackData) or len(b) != len(ClickData):
                BackingRunning = False
                BackData = None
                BackIndex = 0
                ClickData = None
                ClickIndex = 0

        if BackingRunning:
            newdata = (backvolume * BackData + b * globalvolume)
            Click = ClickData * clickvolume
        else:
            Click = numpy.zeros(frame_count*2, dtype=numpy.float32)
            newdata = b * globalvolume

        #  putting streams in 4 channel audio by magic in numpy reshape
        a1 = newdata.reshape(frame_count, 2)
        a2 = Click.reshape(frame_count, 2)
        ch4 = numpy.hstack((a1, a2)).reshape(1, frame_count*4)

        # Mute while loading Sample or BackingTrack
        # otherwise there could be dirty hick-ups
        if SampleLoading or (BackLoadingPerc > 0 and BackLoadingPerc < 100):
            ch4 *= 0
        return (ch4.astype(numpy.int16).tostring(), pyaudio.paContinue)

    else:  # 2 Channel playback
        # if backingtrack running: add in the audio
        if BackingRunning:
            BackData = BackWav[BackIndex:BackIndex+2*frame_count]
            BackIndex += 2*frame_count
            if len(b) != len(BackData):
                BackingRunning = False
                BackData = None
                BackIndex = 0

        if BackingRunning:
            newdata = (backvolume * BackData + b * globalvolume)
        else:
            newdata = b * globalvolume

    outdata[:] = newdata.reshape(outdata.shape)

Change in MAIN CODE

try:
    sd = sounddevice.OutputStream(device=AUDIO_DEVICE_ID, blocksize=512, samplerate=48000, channels=CHANNELS, dtype='int16', callback=AudioCallback)
    sd.start()
#    stream = p.open(format=pyaudio.paInt16, channels=CHANNELS, rate=48000, frames_per_buffer=BUFFERSIZE, output=True,
#                    output_device_index=AUDIO_DEVICE_ID, stream_callback=AudioCallback)

Is MIDI with GPIO serial still working as of today?

See https://www.samplerbox.org/article/midiinwithrpi point 3.

Needs to be double-checked if it still works nowadays, with new kernels.

There are 3 places to check:

Then we have to connect a real hardware synthesizer (e.g. Roland or Yamaha), and see if it still works.

Volume control with piano fader

Hello,
I was trying to add a volume control from a fader on my piano. Looking at your code, I'm trying to set the globalvolume variable with this peace of code (that I placed in the "audio and midi callbacks" section) :

elif (messagetype == 11) and (note == 7):  # Ctrl change
    vol = velocity * 0.3545 - 48
    globalvolume = 10 ** ( vol / 20)
    print vol

Unfortunately, I can see that my fader acts but nothing changes on the audio volume.
Could you guide me in handling this ?

Thank you !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.