Sound clips not working in LiveCode - audio

I can't get any audio clips to play in LiveCode apps.
I'm using wav files, which are supposed to work in LiveCode, and I followed these instructions
For instance, I tried:
on mouseUp
play audioClip `path/filename.wav`
end mouseUp
I also imported the clip (import as control), then used this code:
on mouseUp
play "filename.wav"
end mouseUp
I tried these steps with several clips, all of which play just fine outside of LiveCode.
Clicking the button has an effect -- it keeps you from doing anything else (i.e. clicking another button) for the length of the clip -- but you can't actually hear the sound.

I'll respond to your two examples in reverse order.
The second example looks perfect, and should work. Make sure you have double checked the spelling of the name of the imported audio clip. Also make sure you are using the latest stable release of LiveCode. (I tested it just now in v. 7.0.3 on Mac.) There have been a few bugs recently with audio playback that crept into some of the beta releases, which have since been fixed.
The first example has a couple of potential problems. First, you are using the wrong characters for quoting the relative file path, but that may have just been a typing error when you entered your question. Use double quotes instead:
play "path/filename.wav" -- "audioClip" is optional
Second, you are using a relative file path. This will only work if you have previously set the defaultFolder property to the folder containing your .wav file.
set the defaultFolder to "/path/to/folder"
play "path/filename.wave"
Or you could use an absolute path:
play "/path/to/folder/path/filename/wav"

Related

Creating a Print Monitor / Print Handler

I'm having trouble getting started with building a Print Monitor / Print Handler for Windows using Visual Studio 2012 Ultimate with WDK 8. Basically, this is what I am trying to accomplish:
Create a print monitor (something an application can print to) that will generate a file with the content that should be printed (like the default XPS printer or a PDF printer), and then invokes the print handler
Create a print handler that will parse the generated file and do certain actions with it (check to see if certain text is present, upload the file online, etc)
I feel like the print handler part should not be too hard, but starting with the print monitor is what I'm stuck at. What would I do within VS12? I see options for "Printer Driver V4", "Printer Driver V4 Property Bag", and "Printer XPS Render Filter". Should I use one of those templates, and, if so, what would I do within them? Anything pointing me in the right direction would be appreciated!
EDIT:
Just some more clarification - I only need the text from the print output, but I've read from various sources that getting text-only output leads to no output at all from sources like Firefox, etc since they print text as glyphs.
I will be using the print handler to parse the text for keywords and then upload that information to a web server in a specific format. The print monitor just needs to capture and save the text information from whatever application is printing.
As you pointed out in your comments, some applications such as Firefox print using glyph indices instead of characters. In fact, quite a few do and it's becoming more common. What you need is a print driver. The good news is Microsoft has already written it for you and provided you with sample source code in the WDK. Start by reviewing this to understand your options. The Unidriver is perhaps a little simpler but the Postscript driver has the advantage of generating output that can readily be transformed to PDF or other formats that retain text information (as opposed to raster page images that lose all text information). As far as I'm concerned, don't even think about XPS; it's just an all around disaster.
To handle glyph indices, what you'll need to do is add code to the driver's OEMTextOut function that uses the font's cmap tables to translate glyph indices back into character codes. I'm unaware of any public domain libraries that parse font files, so you'll likely have to write your own code to do this. (Hint: If you support only OpenType/TrueType fonts, you'll cover 99% of all printing applications).
Getting the Microsoft sample code to build, install and run is mostly straightforward, but if you're new to the WDK and installing print drivers, plan on spending a week or more on just that. The glyph index translation part is far more complex and you should plan on spending a lot more time on that.

'modifying' an exe by working with bas using visbasic or q basic

all!
I'm trying to run programs to control stepper motors. The PC and software and stepper motor controller I have already in place are pretty old and I'm new to almost everything I'm doing here-learning as I go sort of thing. I've 'coded' a bit in Matlab, so I have a very basic level of coding logic, but basically no knowledge of any common syntax. So, I know some about the steppers and the stepper controller, but not much else!
I have a program called "Hoop.exe" that I'm trying to modify to slow down the speed of one of the steppers (I just need to change a 300 to a 200!) when I run the program. There is also an associated (assuming) hoop.bas and a hoop.txt file on the floppy disc. From looking at the txt file, it looks like basic code from examples of basic I've seen. I'm working with visual basic 2.0 and qbasic 1.1 on Windows 98.
So, I tried opening the hoop.bas file first with qbasic and with vb. With qb, I get a 'bad file mode' message. With vb, I get 'invalid file format' and it seems it wants me to open a mak file but I have no 'hoop.mak'. I did this thinking that I could open the bas file with vb or qb, and then edit it, and then save it as an exe, and then run that.
I found a pdf that showed how to incorporate a qb file into the command button of vb, and I tried that. But, I got an "Expected: end of statement" error in the first line! when I tried to save it as an exe.
So, all I really want to do is change my hoop.exe. I would assume that since qb and vb are both on the PC, one of them wrote the bas (maybe not!), so I'm wondering why neither of them can read it.
I've never used vb or qb, but if I have to get into the nitty gritty, it seems like I'd rather use qbasic, since I've never used a graphical interface to code before. But, is either one of those necessary in order to do what I want to do? (I'm going to need to write some programs to control these steppers when all is said and done, but I figured that I should take it one step at a time.)
I tried some form of copying and pasting into qb, but I couldn't immediately figure out how to do that. (Probably because I have no idea how to use qb.)
So, what would be the most efficient way to modify my hoop program?
If the answer is that I just need to learn basic with qb, that's fine, but I'd like to get some sort of indication from people who know what they're talking about before I put that much effort in.
I would really appreciate any pointers because I'm apparently completely clueless on my own!
8/10/2013:
Just in case it's helpful, here are some lines from the Hoop.txt I opened:
10 CLS : CLEAR 1000: P = 512
20 LOCATE , , 1
100 A% = INKEY$: PRINT A$;
105 IF A$ = "*" THEN GOTO 700
110 GOSUB 510: GOSUB 610: GOTO 100
500 REM
510 IF A$ = "" THEN RETURN
etc. This is the beginning of the interface code that allows me to talk to the motor controller
QuickBASIC and Visual Basic are very different, despite their common name of "BASIC" and despite the fact they were both made by Microsoft. First you need to determine if the .BAS file is QuickBASIC or Visual Basic. A simple quick way (though not the most accurate) is to open the file up in Notepad or some other text editor. If keywords such as "OPEN" or "LEN" or "MID" or "CLOSE" are in uppercase, then its more likely a QuickBASIC file. If the keywords look more like "Open" or "Close" or "Len" or "Mid", then its more likely a Visual Basic file.
Now keep in mind that there are other versions of BASIC that have been developed, such as Turbo BASIC (Borland's version) or GW-BASIC or BasicA or PowerBASIC and even Color Basic.
Now if you can't figure it out this way, the next thing I'd suggest is downloading a hex editor, such as XVI32 (though there are many other free ones out there). Look through the file (especially towards the end of the file) and there are usually signs that indicate what kind of compiler was used. You might see the words "Microsoft Basic Compiler" or "Borland Turbo Compiler". Usually towards the end of the file, there are string "stubs" put in by the compiler or linker that you can use to determine the compiler.
If all that fails and you are desperate and that "300" number is hard coded in the program and you need to change it, then there is another way to do this. First back up your original exe file. Then Use XVI32 or some other hex editor and search for the string "2c01" (300 is 012c hex and you need to reverse the 01 and 2c since Intel machines are little-endian). Once you find an instance of 2c01, change it to "c800" (200 is 00c8. Little Endian version would be c800). Save the file, then rerun it. This is a gruesome trial and error way to fix this. If it was changed from 300 to 200, then everything is good! If not, restore from your backup and try again!
Have you considered getting an Arduino or some other low cost and friendly electronics development platform? I think it would be the way to go for you to control stepper motors...
take a look:
http://arduino.cc/en/Tutorial/StepperUnipolar
If you google around you'll find tons of you tube videos showing off some arduino controlled stuff.
Modifying your current .exe seems to me a too long and hard path to follow instead of making your own and proper source code for achieving what you want, as you would need to disassemble the executable file and literally "know what you're doing" with all that assembly language to find where to patch the binary with the right value.
Anyway, if you post a picture or a schematic of your old hardware I could try to help you a little more, but I guess that would be better suited to this other stack exchange site:
http://electronics.stackexchange.com

Zebra RZ400 prints an RFID tag, but encodes the subsequent one

I'm trying to use my RZ400 for the first time. I have placed the RFID tags and the ribbon, calibrated the media and sent the
^XA
^RS8
^FO50,50^A0N,65^FDHex Pattern 1^FS
^RFW,H^FD112233445566778899AABBCC^FS
^XZ
instructions from the programming manual and a RFID tag is printed. The problem is that the NEXT tag is the one that gets encoded.
The tags are SMARTRAC 292-2 Belt and the dimensions are 3x0.625 inches. This is a supported tag according to the vendor.
Thanks.
I believe the issue here is the ordering of your ZPL commands.
The ^FO line will print a label with "Hex Pattern 1". However, after printing, it will advance a tag. Try the following code and see if the tag is encoded and then printed on:
^XA
^RS8
^RFW,H^FD112233445566778899AABBCC^FS
^FO50,50^A0N,65^FDHex Pattern 1^FS
^XZ
Hopefully this will solve the issue.
This problem happened to me with the same printer, but printing from Label Matrix software. I was using a Confidex Casey that worked out of the box, but then switched to a Confidex Carrier Pro and the problem started to happen.
This happens because the printer is not properly calibrated with the Tag you are using.
You need to follow the instructions on the Zebra RZ400 Inlay Placement Guidelines for calibrating your Tag. There are three things you can do:
Run the RFID Calibrate command in the front panel of the printer. Try again.
If it's still tagging the next one, then run the command again, BUT use the option RESTORE instead to revert the previous calibration. Try again.
If it STILL doesn't works, you will need to manually calibrate the Pitch value using SetGetDo commands against the printer using the guide in the manual I linked.
Good luck.

Auralise Audacity annotations / Generate audio click track from list of click times

I'm trying to annotate musical audio file in Audacity and then "listen" to annotations along with the file to check they are placed right. I haven't found an Audacity plugin that does it, but when I export Audacity labels I get a file like:
3.558390
4.248639
4.910771
5.632766
6.349320
...
This time of file (in seconds) where point labels were placed. Maybe there's a tool (or maybe you can do it programmatically (in C++ on Linux preferably)) to easily generate such a click track? I would be then able to mix it with original file and listen to inspect it.
I've found two ways to solve this issue:
Write your own plugin in Nyquist (what I'm trying to do), I received great help on the Audacity forum:
http://forum.audacityteam.org/viewtopic.php?f=39&t=68752
Use Sonic Visualiser:
http://www.sonicvisualiser.org/
This program combines two important features: insertion of annotations when audio is played and auralisation (different sounds available).

Quicktime Object Embed Without Buffering

I have a site [here][link removed] (IE8 and Google Chrome 5 only).
I was wondering for the Quicktime object if there was a way to not start buffering unless the user clicks the play button?
I hope to insert other movie files in the future and having them all buffer is not reasonable unless there is no way of getting this done.
thank you.
I found this. It seems like it may not be possible.
the method is on quicktime player use edit and beginning point.
set at the beginning and it starts from the begining and buffers as the movie is played.

Resources