• laszlo.j.hermann

    Hi ,
    to control my process I need two hardware buttons.
    I thought to use the buttons of a bluetooth mouse.
    Is there any experience on this field about any prefered LE Bluetooth device ?

    From the "cb" Documentation:

    • The cb (“Core Bluetooth”) module enables you –to connect to Bluetooth LE (“Low Energy”) peripherals like the TI SensorTag (a small and affordable BTLE device that contains various sensors like an IR thermometer, accelerometer, etc.).
    • The examples in this documentation assume that you either have a standard Bluetooth LE heartrate monitor, or a TI SensorTag, but the module also works with other types of Bluetooth LE peripherals. Note that “classic” Bluetooth (used for headsets, keyboards, etc.) is NOT supported.

    Many thanks,
    László

    posted in Pythonista read more
  • laszlo.j.hermann

    Many thanks. I try to connect to my Mac BT Midi. I would like to use my iPad as a periphery to play and record using Mac ( Pianoteq) sound.
    I configured the Midi-Setup/Midi Studio / Bluetooth , started advertising and your Code works fine to the point, where connecting the Mac bt-midi and both side gets the confirm dialog, but the connection is not established.Any idea?
    If it would connect, can I see the Mac BT Midi in the Pythonista device list delivered by cb.scan_for_peripherals()?

    posted in Pythonista read more
  • laszlo.j.hermann

    Did you found a workaround to communicate with BT midi devices?

    posted in Pythonista read more
  • laszlo.j.hermann

    I figured out. Now I can read, write, realtime (play, record) and edit MIDI files :-)

    posted in Pythonista read more
  • laszlo.j.hermann

    I want to start the play function of the "mido" Python Module on a loaded Midi file from a scene and visualize and play the messages by filling a list of the Midi nodes. Parallel I want be able to play my nodes by touching the screen like in the piano.py. If I start a loop directly from a scene the "touch_began" doesn't catch the messages until the loop ended. Probably I need to start / stop a parallel Thread to play the MidiFile and be able record my nodes in the same time.

    posted in Pythonista read more
  • laszlo.j.hermann

    OK mido helps.

    posted in Pythonista read more
  • laszlo.j.hermann

    Is there any way to start a parallel thread from the scene?

    posted in Pythonista read more
  • laszlo.j.hermann

    Many thanks for the answers. I would need a module to Read and Write/ Manipulate. Midiutil is only for writing/creating MIDI files.
    https://github.com/vishnubob/python-midi/ has the necessary functionality but it has a hardware binding and I'm not so deep in Python to easily port it to Pythonista.
    Any suggestion?

    posted in Pythonista read more
  • laszlo.j.hermann

    Hallo, is there any posibily to reand and write MIDI files in Pythonista 3.
    In Pythonista 2 there was the midiutil.MIDIFILE to crate MIDI Files. In 3 is no midiutil module.

    posted in Pythonista read more
  • laszlo.j.hermann

    As I remember, the first version I had, was not "noisy" by stop_effect. The missing of fade out was not so disturbing the now. The stop_effect has a stronger characteristic of "switch off" noise. Maybe it is only my subjectiv impression.. I created a "88 key" piano app with 4 sec long sound patterns and I feel the low frequency sounds has a strong disturbing switch off noise by short touches. Do you have an other impression?

    posted in Pythonista read more
  • laszlo.j.hermann

    Sound stop_effect stops the sound with a hard "noise" since Last Update of Version 1.6. See example code: If your touch is between 0.1-0.3 seconds, you can hear it. Is there any way to fix it?

    from scene import *
    import sound
    import os

    global keyid
    class Sound (Scene):

    def setup(self):
        sound.load_effect('Piano_F3')
        
    def draw(self):
        pass
    
    def touch_began(self, touch):
        global keyid
        keyid = sound.play_effect('Piano_F3')
                    
    def touch_ended(self, touch):
        global keyid
        sound.stop_effect(keyid)
    

    run(Sound(), PORTRAIT)

    posted in Pythonista read more
  • laszlo.j.hermann

    It works fine, many thanks!

    posted in Pythonista read more
  • laszlo.j.hermann

    @JonB Hallo,
    Problem with @JohnBs AVAudioRecodre Class under actual release
    The https://github.com/jsbain/audiovis.git unfortunatly has a problem under the new Version, but I don't know what to do by the Exception NameError: "global name 'objc' is not defined" in <bound method AVAudioRecorder.del of <main.AVAudioRecorder object at ....>> ignored. Do you have any idee what have to change get it to run?

    posted in Pythonista read more
  • laszlo.j.hermann

    Hallo,

    Can I use my "custom" effects?
    I created the full collection piano CAF (90 keys) to make a small piano app. I created a modified copy of PIANO App and I want to use it with my effects (filename PIANO_01.caf .. PIANO_90.caf). The CAF files and the PIANO.py ist in the Subdirectory root/Piano/. Opening the CAF file in Phytonista "explorer" plays the CAF file.

    How can I address my own CAF files in a .py script?

    I'm using the following code:

    for i in range(0,90):
      effect_name = 'PIANO_'+str(i+1).zfill(2)
      self.sounds.append(effect_name)
      sound.load_effect(effect_name)
    

    unfortunately the sound.play_effect(self.sounds[index]) doesn't plays any node.

    Is there any suggestion?

    Thanks and cheers.

    posted in Pythonista read more
  • laszlo.j.hermann

    When the hardware is muted or volume is down, the demo piano app also wouldn't work. But it is working. The memory allocation can be a reason, so I reduced the number of effects.

            if i in range(47,49):
                sound.load_effect(filepath)
    

    but no difference.
    How can I validate the success of load_effect()?

    I can check the sound.Player() but I don't understand why it is not working since yesterday (without any changing in the code).

    I generated the 90 sounds with Pianoteq and it was the range I defined and not the 88 keys. 😊

    posted in Pythonista read more
  • laszlo.j.hermann

    Unfortunatly it is not the point. I already stopped every other Apps and rebooted. No sound. ( The Piano.py demo app working properly but not my one )

    posted in Pythonista read more
  • laszlo.j.hermann

    Hmmm, new effect...
    Now I have no sound or sound is muted after I started a Radio App.
    But the demo Piano.py works.

    Loading the custom sounds:

    for i in range(0,90):
               filename = 'PIANO_'+str(i+1).zfill(2)+'.caf'
               filepath = './PianoCAF/'+ filename
               self.sounds.append(filename)
               sound.load_effect(filepath)
               if os.path.exists(filepath):
                   print(self.sounds[i])
    

    File are printed also they are existing.

    def touch_began(self, touch):
           sound.set_volume(0.5)    
           self.pitchmodifier = 0      
           self.nodevalue = 13 - int((self.size.w - touch.location.x) / (self.size.w/13))    
           self.start_nodeindex = 40 + self.nodevalue+(12*self.pitchmodifier)
           print('On index: '+ str(self.start_nodeindex))
           print('On sound: '+ self.sounds[self.start_nodeindex])
           self.keypressed[self.nodevalue] = self.start_nodeindex
           sound.play_effect(self.sounds[self.start_nodeindex])  
           #direct test of sound
           sound.play_effect('PIANO_42.caf') 
    

    stdout:

    On index: 50
    On sound: PIANO_51.caf
    

    but no sound.
    Any suggestion?

    posted in Pythonista read more
  • laszlo.j.hermann

    many thanks it works :-)

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!