Wikipedia:Reference desk/Archives/Computing/2012 March 4

= March 4 =

Anvil Studio: Scrolling the piano-roll
I have a problem which should have an obvious and easy solution, but doesn't. I'm using Anvil Studio to compose MIDI, and can't for the life of me figure out how to get it to show me notes higher than C 5 or higher than the B above that on the Piano Roll view. How can I do that? 97.125.17.72 (talk) 08:15, 4 March 2012 (UTC)
 * Most MIDI instruments, synthesizers, and software have a limited 7-bit range for notes. This means that most syntesizers and software only permit a total range of 127 notes - because of a technical detail of how MIDI works.  See, for example, the MIDI Note On- and Off- message format.  Some synthesizers can expand the range by presetting a range with a custom Channel Control/Mode message (compare to the "octava" 8va and 8vb in conventional sheet music notation). However, there's no guarantee that a specific MIDI instrument or hardware sound card would understand such a special control/mode message. I'm not specifically familiar with Anvil, but it sounds like it is range-limiting you on purpose to remain compatible with the lowest-common denominator of the standard MIDI synthesizer output.  Nimur (talk) 17:08, 4 March 2012 (UTC)


 * Even though 7 bits may sound limited, 128 notes (0 to 127) is very adequate. Refer to the chart at Range (music) which uses middle C = C4. Here's the MIDI range, depending on what you call middle C.
 * {| class="wikitable"

! Middle C !! MIDI range
 * C3 || C-2 to G8
 * C4 || C-1 to G9
 * C5 || C0 to G10
 * }
 * In any case, C5 to B5 are not near the upper limit of the MIDI range. --Bavi H (talk) 02:57, 5 March 2012 (UTC)
 * C5 || C0 to G10
 * }
 * In any case, C5 to B5 are not near the upper limit of the MIDI range. --Bavi H (talk) 02:57, 5 March 2012 (UTC)


 * I just downloaded the current version of Anvil Studio. The Piano Roll defaults to showing one octave from Middle C (which Anvil Studio calls C5) to the B above it (12 notes). The bottom half of the screen is devoted to help information. According to the help text, "To change which notes and octaves get displayed on the grid, press the Add Sounds button." (?!) Thankfully, in the Add Sounds dialog box you can choose both the lowest note and the number of notes to show. For example, if you want the Piano Roll to show the entire MIDI note range with a scroll bar, you could choose Lowest Note = "C 0 (midi 0)" and Numer of notes to show = 128. --Bavi H (talk) 03:00, 5 March 2012 (UTC)
 * Thanks! That was exactly what I was looking for. 97.125.17.72 (talk) 03:19, 5 March 2012 (UTC)
 * If you are comfortable installing programs from zip files, may I also suggest Sekaiju as another possible MIDI sequencer. Note that you have to change the language from Japanese to English: Alt+S, L, English, restart. (Or before starting Sekaiju, open Sekaiju.ini and change Language=Japanese to Language=English.) --Bavi H (talk) 03:47, 5 March 2012 (UTC)

google docs image problem
Hi. I have a large (2.5MB) jpeg image which I would like to include in a google document. Using 'insert -> image' does not work, giving an error "The image you selected is too large. Only files smaller than 2000 by 2000 pixels are allowed." OK, so I open the image in gimp and save at 4% quality, which reduces the size to about 40K. But this does not solve the problem: google docs gives the same error. This is presumably because the resolution (which gimp reports as 3072x1728 for both the original image and the reduced quality copy) is still too big. Can anyone advise (kubuntu/windows 7; free software only) please? Robinh (talk) 08:34, 4 March 2012 (UTC)
 * You don't need to save it at a lower quality level, but at a lower resolution. Good old xv can do it. Also, ImageMagick can do everything. Try . ImageMagick is, as far as I know, available for every OS on the planet, and usually installed by default on most Linux systems. --Stephan Schulz (talk) 09:19, 4 March 2012 (UTC)


 * Since you're already using GIMP, the feature is right there - select Image > Scale Image, then change the width to 2000 or less. AJ  Cham  09:24, 4 March 2012 (UTC)


 * thanks guys.  Two perfectly good solutions!  Best wishes, Robinh (talk) 09:46, 4 March 2012 (UTC)

From vector to coordinates, from coordinates to vector
If you have a svg image, can you convert it back to its mathematical coordinates or if you have some mathematical coordinates (imagine circle, r = 30 pixel, position (50, 50) in a imagine 100 x 100 pixel), how can you convert it into an svg file? XPPaul (talk) 14:08, 4 March 2012 (UTC)
 * Start by reading the W3C Standard describing the SVG Rendering Model, and learn the primitive data types. Then, decide on a case-by-case basis.  For example, SVG has a primitive to render a circle; or, you can approximate a circle by rendering as many line segments as you like.  So, you have to decide which model to use when you draw a circle for your own project.  In general, the SVG Coordinate object is the data primitive that defines position in a rendering context.  A coordinate can be used as part of another element, like a spline, line-segment, or circle.  If you want to convert a general SVG document back to cartesian coordinates, by definition you must use an SVG renderer (or, you can sloppily re-implement one of your own).  If your SVG document has a lot of line-art, you may be able to extract those coordinates and draw them using a dramatically simplified subset of the full SVG specification.  Nimur (talk) 17:21, 4 March 2012 (UTC)


 * If you're looking for a way to render mathematical coordinates as SVG graphs, gnuplot is a common way to do it. Going backwards from SVG to a gnuplot-like language is probably not possible (or doesn't make any sense, anyway — SVG is already a structured vector format; so converting the SVG circle specification to another one seems like a rather arbitrary conversion scheme). --Mr.98 (talk) 20:48, 4 March 2012 (UTC)

math question on program
I posted a question on the math reference desk that is actually a script, and perhaps this is a better place to ask if others get the same results. The mathematicians can tell me why that happens, if so. Thanks. --80.99.254.208 (talk) 19:42, 4 March 2012 (UTC)
 * This is the question: Reference_desk/Mathematics RudolfRed (talk) 21:38, 4 March 2012 (UTC)
 * I think they're answering your question pretty well. You should consider condensing your explanation a bit. And you're also leaving out the most important details: how you are working your random numbers to get a dice throw; is there something going on with your math here (seems to be your expected values might be wrong). It seems either you're getting artifacts due to the underlying RNG you're using, or how you're handling it. Use the same method and see if your distribution is uniform.


 * It also appears everything may just be working fine. Why don't you ask the math desk this simple question: For n rolls of a fair dice, what is the largest expected number of runs of consecutive 6s. That would provide you the longest expected number of busts for your "enormous number" of runs. Shadowjams (talk) 19:46, 5 March 2012 (UTC)


 * As a follow up, here's a little perl program that will count for you the number of runs of each duration for a given n. It does this by rolling a dice, seeing if it's a consecutive run, and then recording the length of the runs. It should provide you a reasonable approximation of what you'd expect.


 * 1) !/usr/bin/perl

my $last_roll = 0;my $in_a_row = 0;my $x = 1;my %count; while (1) { my $roll = (int rand(6)) + 1; if ($roll == $last_roll) {$in_a_row++} else {$count{$in_a_row}++ if $in_a_row > 2; $in_a_row = 0} $last_roll = $roll; unless ($x % 1000000) {print "\nIn a row\t#\t($x runs)\n"; foreach (sort {$a <=> $b} keys %count) {print "$_\t\t$count{$_}\n"}} $x++; }


 * I get this distribution after 100 million runs:

In a row       #       (100,000,000 runs) 3              321785 4               53392 5               8887 6               1488 7               271 8               40 9               5 10              3 11              1


 * Does this match your data at all? Shadowjams (talk) 21:45, 5 March 2012 (UTC)
 * It's not what the script was. The script was originally this: http://codepad.org/bU68pFDc - as you can see, it busts!  Keep running it and it keeps busting. --80.99.254.208 (talk) 10:30, 6 March 2012 (UTC)
 * sorry, it has a mistake (it shouldn't exit but just exit the loop), but you get the idea...
 * As I said on the Math desk, some language implementations (including Perl) use 's defective random number generation. Try again using Math::Random::MT. Paul (Stansifer) 18:35, 6 March 2012 (UTC)
 * Yes, I know it's not the same program... I'm not rewriting the OP's program for him/her... I was however trying to help the OP wrap their mind around random walk distances. As for perl's RNG... I suspected it wasn't very robust, although that link is interesting. I actually looked at some distributions of numbers that came out of it and they were less uniform than I'd expect, although I didn't get any more elaborate in checking than looking at a few runs, so that's just an anecdote. However, I'm not sure they change my results significantly, although I may try one of the modules and see what happens. Shadowjams (talk) 20:11, 6 March 2012 (UTC)
 * Ran it again using MT. No statistical difference in results. Shadowjams (talk) 21:23, 6 March 2012 (UTC)

Skype: incredibly loud artificial background noise
If I use Skype on my latest laptop, more often than not I get artificial background noise (the other end not hearing it at all, not like feedback or anything). It works up and down in loudness in waves, can get really quite loud and can easily disrupt conversation. The sound definitely comes from Skype, and is inseparable in the Windows mixer from the actual Skype conversation. I don't know if this is related, by my Skype-computer combination also deducts system sounds from the microphone input (the other end can't hear music I'm playing, for example). Does anyone have any ideas on how I can rid myself of this din? Thanks! - Jarry1250 [Deliberation needed] 20:33, 4 March 2012 (UTC)


 * Does it happen when you don't have it deduct system sounds from the microphone input? That seems like the obvious thing to rule out first. And I wonder if you can't describe the noise a little bit better. Is it white noise or something else? --Mr.98 (talk) 20:51, 4 March 2012 (UTC)


 * It's not white noise, it's more like someone with one of those handheld electric fans passing it by your ear every few seconds. I've never found a way to stop it deducting my output from the input, but it's probably possible. - Jarry1250 [Deliberation needed] 21:10, 4 March 2012 (UTC)
 * One thing that might suggest it's not that is that the sound is independent of whether or not I have my microphone enabled or disabled (another sign it's not feedback). - Jarry1250 [Deliberation needed] 21:20, 4 March 2012 (UTC)


 * Maybe it is the other end's processor fan or disk drive? I find that a significant problem with built-in microphones in laptops.  Ask the person on the other end to use an external mic, or a headset.  Astronaut (talk) 16:54, 5 March 2012 (UTC)
 * Sounds an interesting idea, will have to try it. - Jarry1250 [Deliberation needed] 16:59, 5 March 2012 (UTC)