w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to use Python to generate real-time midi signal and output it to midi device?
Python-RTMIDI is in alpha stages (haven't tried it yet myself, but it's my primary choice for an upcoming hardware synth editor project) It's a C++ Python extension, so it might not be painless to setup but then you get CoreMIDI as well as optional JACK support, might be worth your while.

Categories : Osx

Play midi with Core Midi on device
A corrected answer now that I understand better the question. A sample of one of my projects. // Setup MIDI input port MIDIClientRef client = NULL; MIDIPortRef inport = NULL; CheckError (MIDIClientCreate(CFSTR("MyApplication"), NULL, NULL, &client), "Couldn't create MIDI client"); CheckError (MIDIInputPortCreate(client, CFSTR("MyApplication Input port"), &inport), "Couldn't create input port"); [self setInputPort:inport]; [self setMidiClient:client]; [self setDestinationEndpoint:[[self midiSession] destinationEndpoint]];

Categories : IOS

How can i Write data from Android device on c2540c device?
Might this solve your problem?

Categories : Android

Atomicity of UNIX read()/write() when sending data to device
File pointers (FILE *fp, for example), are a layer in the user-side code sitting above the function calls (such as write()). Access to fp is controlled by locks in a threaded environment (you can't have to threads modifying the same structure at the same time). Inside the kernel, I'd expect there to be a lock on the file descriptor (and/or 'open file description') to prevent it being used from two threads at once. You can look up the POSIX specification for read() and getchar_unlocked() to find out more about locking etc — at least for a POSIX compliant implementation. Note that POSIX still uses C99. Therefore, it is not cognizant of the C11 thread facilities. The C11 standard does not have read() et al (file I/O using file descriptors), so it says nothing about such system calls.

Categories : C

How to write a service to keep track of gprs data usage on android device
You need to do the following : Create a local database that will store the data usage values . Start a service which runs continuously / periodically to calculate /recalculate the data usage . After data usage is calculated by the service ,add the data into your data usage table . To create local database you can refer to this tutorial on sqlite Here is how you can start a service Creating a Service in Android EDIT There is no way to get notified if any fresh data usage is made .You will have to periodically check it using your service that will run continuously or periodically . You can use the following code to calculate the usage : int UID=Process.myUid(); long recived = TrafficStats.getUidRxBytes(UID); long send = TrafficStats.getUidTxBytes(UID); Other functions that you ca

Categories : Android

Why can't I read data from /dev/snd/midi*?
CL's comment was correct. Amidi shows the right data. So now I just gotta code the same thing that amidi does. Thanks! apaksi@extruder:/dev/snd$ amidi -l Dir Device Name IO hw:0,0,0 nanoKONTROL MIDI 1 IO hw:1,0,0 MIDIMATE II MIDI 1 IO hw:1,0,1 MIDIMATE II MIDI 2 apaksi@extruder:/dev/snd$ amidi -d -p hw:1,0,1 F8 F8 F8 F8 F8 F8 F8 F8

Categories : Linux

Saving MIDI data to a buffer Using C++
The first byte after MTHD is 0, so printf will only print MTHD since a C string ends with a zero byte. If you want to print the contents of the MIDI file you're going to need to convert the bytes of the file into hex.

Categories : C++

Can you write multiple IP packets in one write to the linux tun device?
Actually multiple packets were returned by the driver because it had been enhanced locally. The tun driver that comes with linux only returns one packet per read. The driver also expects only one packet per write.

Categories : Misc

Convert MIDI to Java data structure (List, Hash Map, ???)
Reading the MIDI file specifications, I think you can start creating anything like public class MIDIFile { enum FileFormat { single_track, syncronous_multiple_tracks, assyncronous_multiple_tracks; } FileFormat file_format; short numberOfTracks; short deltaTimeTicks; //Create Class for tracks, events, put some collection for storing the tracks, //some collection for storing the events inside the tracks, etc //Collection<Integer, MIDITrack> the type of Collection depends on application } public class MIDITrack { int length; //Collection<MIDIEvent> the type of Collection depends on application } public class MIDIEvent { int delta_time; int event_type; //Use of enum or final variables is interesting

Categories : Java

Invalid MIDI message Data when I'm trying to send Control Change Messages
MIDI status bytes (the first byte of the message) must have the high (0x80) bit set. the linked chart is a bit confusing, but I'm guessing 0x74 is a data byte and must be preceded by the proper status byte. >>> import pygame.midi as midi >>> midi.init() >>> midiout = midi.Output(0) >>> midiout.write_short(0xb0, 0x74, 124) some basic MIDI documentation: http://www.midi.org/techspecs/midimessages.php control change is 0xbn, where n is the channel number, so 0xb0 is a control change message for channel 0.

Categories : Python

Sum a sequence of device-labeled, data using most recent data for device
I am building on my answer to your previous question, where you presented a simpler case. Read there for an explanation of the window functions aspect of the solution: Sum across partitions with window functions This question presents a "counter-cross-tabulated" data-set. To get to where you want to be, you could run a cross tabulation first, reducing the case to its simpler, previous form. PostgreSQL has the additional module tablefunc providing very fast functions for that. Run this command once per database to install: CREATE EXTENSION tablefunc; Then all you need is this (including redundant columns in the result for debugging): SELECT ts, active_power, device_id, should_be , COALESCE(max(a) OVER (PARTITION BY grp_a), 0) + COALESCE(max(b) OVER (PARTITION BY grp_b), 0

Categories : SQL

Sending image (.jpg) byte data to an iOS device from a .NET web service, then on the iOS device, encoding it to its respective file type (.jpg)
Been there, but on the iOS end. What we did to solve this problem was to have the .NET server send the image as a base64 encoded string, just as you said. In the iOS end, the dev must then use a base64 decoding class (there are plenty on the internet, this one for example: http://www.imthi.com/wp-content/uploads/2010/08/base64.zip), transform that into NSData and then create the image with that data. Should look something like this: NSString *b64string = @"string to decode"; NSData *imgData = [DecoderClass decodeBase64FromString:b64String]; UIImage *image = [UIImage imageWithData:imgData]; If the data is correct, it should work. UIImage is a high-level class and should handle image types (jpg, png, etc) automatically, as long as the data is consistent.

Categories : C#

How to write log file in ios device?
"Cocoa Lumberjack" framework is widely used all over the world for creating logging files. You can get all information, tutorial, sample code about it by googling Cocoa Lumberjack. Here are links for you to download cocoa lumberjack library and tutorial: Framework Link: Cocoa Lumberjack Library Tutorial: CocoaLumberjack: Logging on Steroids

Categories : C++

write() not writing to device
It seems like this has been beaten to death but char obj = 0x00; fd = open(file, O_RDWR, DEFFILEMODE); lseek(fd, 0, SEEK_SET); write(fd, &obj, bytes); Is not going to write zeros. It's going to write garbage from the stack.

Categories : C

How to write apps that syncs to device's refresh rate?
You should use animation APIs. See for instance the documentation of ValueAnimator: http://developer.android.com/reference/android/animation/ValueAnimator.html#setFrameDelay%28long%29 This documentation says: "The frame delay may be ignored when the animation system uses an external timing source, such as the display refresh rate (vsync), to govern animations." I don't know whether all devices use vsync (would be curious to test), but it sounds very much like the right way to get animation smoothness. See the developer's guide about property animation: http://developer.android.com/guide/topics/graphics/prop-animation.html In addition, there is an API that will give you the refresh rate: http://developer.android.com/reference/android/view/Display.html#getRefreshRate%28%29 ((WindowManag

Categories : Android

How can i write unit test for code that connected a device
Use a mock library, for example: http://www.hibernatingrhinos.com/oss/rhino-mocks . Then, in the unit test you can create a mock that implements the device's interface, and you can verify that a particular method (in this case - reset) was called.

Categories : C#

C# SerialPort.Write is taking a long time to write data
The baud rate is bits per second, not bytes per second. 420 bytes is 3360 bits, so the raw data takes 3360/9600 = 0.35 seconds to send. So, 400 ms seems very reasonable when the overhead is included.

Categories : C#

Using GCM for device to device app data sync
you dont necessarily need to use GCM or any messaging service, all gcm is meant to do is notify a device that something has changed on your server and that you need to go get all the new stuff. that being said all you need to do is just have a sync button that the user can manually sync the list from the server to the device and vice versa which would get rid of the need for GCM. if you wanted automatic syncing then GCM or any other messaging service would be what you want

Categories : Android

write () call failed: No space left on device: ENOSPC handling
Just because you are seeking to the beginning of the file doesn't mean that the file is truncated. It's possible to do random writes on a file. Writing down a block on a full file system is going to cause issues. If you want to truncate the file use truncate(2) or ftruncate call on the file BEFORE lseek try: if(errno == ENOSPC) { ftruncate(gi4LogFd, 0); lseek(gi4LogFd, 0, SEEK_SET); break; } Okay so ext3 filesystem with journaling support does not create an issue on a full fs: Setup: Create an image file: dd if=/dev/zero of=/tmp/img.dsk count=8192 Created an ext3 filesystem on a 4k image file: mkfs.ext3 /tmp/img.dsk sudo mount /tmp/img.dsk /mnt/internal sudo chown masud.users /mnt/internal touch /mnt/internal/file.bin sudo dd if=/dev/urando

Categories : C

Allocating memory in OpenCL that creates a host pointer but doesn't write it to the device until it's needed
The standard only states that: This flag specifies that the application wants the OpenCL implementation to allocate memory from host accessible memory. So, how it works under the hood is implementation dependent. NVIDIA states in section 3.3.1 of its OpenCL Programming Guide (V4.2) that: objects using the CL_MEM_ALLOC_HOST_PTR flag (...) are likely to be allocated in page-locked memory by the driver for best performance. In their own guide (here) AMD, gives in section 4.5.2 a table displaying the location of the memory objects for each flag values. The entire section 4.5 is dedicated to OCL memory objects. You might find it interesting. Regarding your problem, if you don't have enough memory space there is no other solution (at least that I can think of) than to split your

Categories : C++

how to store data in NS-Mutable-data in did-receive-data and than write to file
It's better to use asynchronous requests for the task like this. You can use the same ASIHTTPRequest class, but with block approach. Try to write the code similar to this: -(void) verifyReceipt { NSURL *theURL = [NSURL URLWithString:@"http://testing.io/dev.php/video/verifyReceipt"]; NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:theURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10.0f]; [theRequest setHTTPMethod:@"POST"]; NSString *param1 = [self getParam1]; // getParam1 - some method to get useful data for request's body NSNumber *param2 = [self getParam2]; NSString *postString = [NSString stringWithFormat:@"param1=%@&param2=%@", param1, param2]; [theRequest setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEnco

Categories : Iphone

Genymotion. How to pull database from device. my /data/data/ folder appears to be empty
I managed to kind off go around the issue so I post my solution in case someone will find it helpful. Previously I've been creating VM's with no google apis, superUser app crashed every time I wanted to root the phone. so I created VM that is provided with google play and downloaded SQL Debugger App. I also use this code in my test suite and so I fetch db to SD-card at the end of every test I run. That way I don't need to have superuser permissions. public static void copyDbToSd(Context context) { File dbFile = context.getDatabasePath((String) DatabaseHandler.DATABASE_NAME); InputStream myInput; try { myInput = new FileInputStream(dbFile); OutputStream myOutput = new FileOutputStream( Environment.getExternalStorageDirectory()

Categories : Android

MIDI Programming for web
It looks like it's possible. There is a browser plugin by Jazz-soft which adds low level MIDI support. http://jazz-soft.net/ WebMIDI is an API supporting the MIDI protocol, enabling web applications to enumerate and select MIDI input and output devices on the client system and send and receive MIDI messages. http://www.w3.org/TR/webmidi/ A bit of web searching also turned up something called Web MIDI API Polyfill.

Categories : Windows

How is data typically reloaded/displayed on a device when only a tiny amount of data changes after updating the database? (Conceptually)
This is ridiculously trivial. You update your local database and send off the remote update at the same time. You use the remote response to mark your local record as synched or try updating again later.

Categories : IOS

Java MIDI without MidiMessage
If I understand your issue correctly, can't you reuse a single MidiMessage object in your code and reassign its data via setMessage()? This way the reference is never lost and will not be garbage collected.

Categories : Java

Usb Midi cable on iOS simulator
No. The External Accessory framwork does not work in the iOS simulator according to Apple

Categories : Objective C

Is it possible to write an Android app that uses Google Maps on android device with OGL1.1?
My device does not have OGL 2 - so is it now physically impossible to write an app that uses a Map? You cannot use Maps V2. You are welcome to use OpenStreetMap or other mapping engines.

Categories : Android

API/Library for MIDI tune creation in C#?
C# (.NET) does not have a MIDI API. The only API available on Windows is the old Multi-Media library AFAIK. Check out MIDI.NET that wraps this Windows API and makes it available to .NET (C#,VB.NET, etc.). It provides a Factory object to create (pooled) note messages and includes reading and saving MIDI files. If you have any questions post them in the discussion list on the codeplex project site. Hope it helps, Marc (Author of MIDI.NET)

Categories : C#

Manipulating MIDI Files in Python
You probably can't "alter existing files" if you mean modifying them in-place. But you can just parse the MIDI file, change it (in-memory, or iteratively), and write a new one. You didn't mention which packages you looked at to write MIDI files, but every one I've ever dealt with can also read MIDI files, so you probably already have everything you need. And there's nothing requiring you to use the same package for both reading and writing. For example, you can use midiparser for reading and python-midi for writing; the code to map MIDI messages from one package's format to the other is trivial.

Categories : Python

Get MusicSequence callback from MIDI Playback
There's a tutorial on how to capture midi events from a MusicSequence here (such as note on/off): http://www.deluge.co/?q=midi-driven-animation-core-audio-objective-c In brief, the method is to call MIDIDestinationCreate to create your own MIDI endpoint to handle the MIDI messages, and then point your MusicSequence at it with MusicSequenceSetMIDIEndpoint.

Categories : IOS

How to implement a MIDI driver for the Roland UM 4?
Since it's a USB device, I would have hoped it just used the standard USB MIDI class. But then it would have worked, so I guess it doesn't. Bummer. To implement a driver, you're going to need to reverse-engineer the USB protocol between the 32-bit driver and the hardware. This is not super-easy (I've not done it, but I have some knowledge). You must capture the traffic, which is typically done with a USB protocol analyzer, which are not cheap. I think it can be done with a regular PC in the middle (perhaps running Linux) but that can get kind of complicated, too. So, the limiting factor here is probably not your programming skills per se, but rather the fact the reverse-engineering is hard.

Categories : C++

Tempo and time signatures from MIDI
MIDI doesn't represent notes in absolute quantities, like in classical music. Instead, the length of the note continues until a corresponding note off event is parsed (also it's quite common that MIDI files use a note on event with 0 velocity as a note off, just keep this in mind). So basically you will need to translate the time in ticks between the two events to musical time to know whether use a whole, half, quarter note, etc. This translation obviously depends on knowing the tempo and time signature, which are MIDI meta events. More information about parsing those can be found here: http://www.sonicspot.com/guide/midifiles.html Basically you take the PPQ to find the number of milliseconds per tick, then use the time signature and tempo to find the length of a quarter note in millis

Categories : Misc

No MIDI sound using CoreMIDI, Ruby, Mac OS X Lion
OK, finally found it. Found this: https://www.ruby-toolbox.com/categories/music_midi and https://github.com/arirusso/unimidi Thanks to folks over at reddit.com/r/ruby http://www.reddit.com/r/ruby/comments/1hwwk5/need_help_finding_a_software_that_takes_in_midi/ Love Reddit. Note: For some reason stackoverflow does not support URL address with double underscore. The first url is actually "music__midi

Categories : Ruby

Play midi file in an asynctask on Android
You need to wait until the file is played. Because the MediaPlayer mediaPlayer is created as local variable it will be release at the end of protected Void doInBackground { You have two options. 1) Make the mediaPlayer variable of class that live long enough 2) OR, put a loop reading mediaPlayer.status. Something like this: while (mediaPlayer.status==MediaPlayer.Status.PLAYING) sleep(100);

Categories : Android

I'm having trouble accessing midi files in a different folder
Paths are relative to the current directory, which isn't necessarily the same thing as the directory your script or module is in. To check what it is, add: print os.getcwd() To compute paths relative to a module directory, you can do something like this: module_directory = os.path.dirname(__file__) filename = os.path.join(module_directory, 'Audio', 'town3.midi') (__file__ gives you the module's filename, and os.path.dirname strips off the file part) A simple helper function might be useful: def load(midi_file): filename = os.path.join(module_directory, 'Audio', midi_file) pygame.mixer.music.load(filename) load('town1.midi') load('town2.midi') load('town3.midi')

Categories : Python

error reading MIDI files into program
If I'm not mistaken, running status still requires a variable time delta to be specified, so even if the two events happen at the same time there would still be a 00 byte proceeding the running status. However, with that in mind the aftertouch event in your above dump would lack any time offset, so I'm stumped.

Categories : Misc

Trying to run "pygame.examples.midi.main" but get a SyntaxError
Your problem is with -> None. That's not part of Python syntax. It's part of the documentation, just to show you what the return value of that function is. Remove that from your code and it should work.

Categories : Python

Adding a repeat function to a simple MIDI player
You need to maintain shared state between your workers. Introduce new boolean variable "playing". Before execution check whether playing flag is set to true, after execution set it to false again.

Categories : Java

How to extract all the instruments played in a midi file format?
You can take a look at JUCE. It has a lot of MIDI functions that may help you figure out what you need to know. You can also look here for a description of the MIDI file format.

Categories : C++

Get midi sequence (MusicSequence) markers generates with Logic
Markers are contained in the MIDI file as Marker Meta Events. So you need to extend your parsing to support meta events. Meta Events have the status 0xFF. For markers the next byte is 0x06, then a length and a number of characters.

Categories : IOS



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.