Page 1 of 1

How Do I Import Files Without Dropbox?

Posted: Sun May 12, 2019 5:27 am
by rbytes
;)

Re: How Do I Import Files Without Dropbox?

Posted: Sun May 12, 2019 12:06 pm
by Henko
The videofile was downloaded, but only 1499 bytes size ??
It didn't play, just got a white screen with the quit button at the bottom.
But important fact is that a download from a website into the sB sandbox succeeded

Re: How Do I Import Files Without Dropbox?

Posted: Sun May 12, 2019 1:25 pm
by rbytes
Hmm. Maybe timed out partway through. Please try a few more times and let me know if you can ge the whole file. The size should be 2.05081E+07

Re: How Do I Import Files Without Dropbox?

Posted: Sun May 12, 2019 5:52 pm
by rbytes
Oops. Found an error in my download code. I have reposted it. It should work for you now.

There is still an issue with testing for the correct file size, which is 2.05081E+07, just over 20 megabytes

What I thought would work was:

if sz=2.05081E+07 then ' test for equality
print "Successfully downloaded ";a2$
else
print "Download incomplete"
endif

But that always gives an incorrect answer!


So I changed it to:

if sz>2.05080E+07 then
print "Successfully downloaded ";a2$ 'test for greater than the next smaller size
else
print "Download incomplete"
endif

This change is not as accurate, but at least gives the correct response for a successful download.

Anyone know why this happens?

A second file to download

Posted: Sun May 12, 2019 9:17 pm
by rbytes
;)

A third file to download

Posted: Tue May 14, 2019 11:01 pm
by rbytes
Continuing the demonstration of how you can import various types of files into Smart Basic without using its Dropbox connection ....

The third file I have available for you to download is an explosion sound effect. It is a .wav audio file - uncompressed.
Here is the download code:

;)

Re: A second file to download

Posted: Wed May 15, 2019 10:57 am
by Henko
rbytes wrote:
Sun May 12, 2019 9:17 pm

Code: Select all

N$="Alan Parsons.mid"
FILE N$ SETPOS 0
NOTES LOAD N$
NOTES PLAY
PAUSE NOTES_LENGTH (N$)
Hi, an error occurred: notes_length() must not have an argument.
Further, the test was succesfull

Re: A third file to download

Posted: Wed May 15, 2019 11:03 am
by Henko
rbytes wrote:
Tue May 14, 2019 11:01 pm
Continuing the demonstration of how you can import various types of files into Smart Basic without using its Dropbox connection ....

The third file I have available for you to download is an explosion sound effect. It is a .wav audio file - uncompressed.
Here is the download code:

Code: Select all

a2$="explosion.wav"
dn$="http://ricardobytes.com/ftp1/explosion.wav"
HTTP dn$ GETDIM m   'use the full url here.
FILE a2$ WRITEDIM m 'save just the filename.
sz=FILE_SIZE (a2$)
If sz>0 then
   Print "Connected to file..."
   print "Downloaded file size: ";sz;" bytes"
   if sz=37284 then
     print "Successfully downloaded ";a2$
   else
     print "Download incomplete"
   endif
else
   Print "file not found"
endif
end

To play the sound effect, run this code:

Code: Select all

M$="music"
F$="explosion.wav"
MUSIC M$ LOAD F$
MUSIC M$ PLAY
PAUSE MUSIC_LENGTH (M$)
end
I keep getting the message "download incomplete", with a "filesize" of 1699 bytes.

Re: How Do I Import Files Without Dropbox?

Posted: Wed May 15, 2019 1:21 pm
by rbytes
Yes, I see now that NOTES_LENGTH() does not take an argument, yet MUSIC_LENGTH() does. The code for file 2 is fixed now.

I keep getting the message "download incomplete", with a "filesize" of 1699 bytes.
I have also found and fixed the issue with file 3. I had copied all of the files to a folder called Test, but hadn't corrected the path for file 3. Sorry about that. Please use the new code.

Re: How Do I Import Files Without Dropbox?

Posted: Wed May 15, 2019 1:32 pm
by rbytes
Here is the 4th and last file to download. It is an mP3 sound effect of a fidget spinner. The download code:


;)