Search Results (9 posts found):
I've just started a little C programming project in order to improve my C programming and, indeed, to see if I'm actually clever enough to write something in C. The project I've chosen is a little ID3 tag editor for MP3 files.
I've chosen this because it might be useful and because it involves something I quite enjoy, which is parsing files. It's also the sort of project that doesn't need a GUI but can later be extended to have one.
I chose C because, as stated earlier, I wanted to prove to myself that I can do it and because it's a great language for byte level manipulation of the sort required to parse a binary file like an MP3.
MP3 files support two types of ID3 tag, these being version 1 and version 2 (of which there are 4 types). ID3v1 tags reside at the end of the mp3 file and are limited in length to 128 total bytes: 3 for the keyword "TAG", 30 each for the title, artist and album, 4 for the year, and then either 28 or 30 for a comment, and, if using a 28 byte comment, 2 for the track number, and finally 1 byte for the genre.
ID3v1 tags are therefore trivial to manipulate.
ID3v2 moved the tags to the start of the file and introduced the concept of separate frames of data, each to store one tag and its value.
The ID3v2 header starts with the values "ID3" (0x49 0x44 0x43 in hex) followed by the minor version number (0x03 for ID3v2.3, 0x04 for ID3v2.4, etc) and then the build number (usually 0), a byte for flags related to the ID3 tagss, and finally four bytes for the overall ID3 header size. Thus an ID3v2 header can be identified by looking like this:
49 44 33 vv vv ff xx xx xx xx
Where vv are the version bytes, ff is the flags, and xx xx xx xx is the big-endian header size.
When I first started writing the decoding function for the ID3 header I was reading the number of bytes as dictated by the xx xx xx xx in the header, but found I was reading well beyond the end of the header itself, causing all sorts of problems. This led me to a google search where I discovered the concept of "Sync-Safe Integers".
These sync-safe integers are not a universal computing concept, but rather one created purely for MP3 encoding, it seems. And this is where sychronisation safe integers come in.
In order for those four bytes indicating header size to not be confused for later bytes that are used to synchronise data frames they cannot contain the values "FF 00" and the way to do this is to ensure that no bytes not intended for syncronisation contain the value FF unless always guaranteed to be followed by a non-zero value, such as the byte order marker FF FE.
To do this, we insert a zero at bit 8 (the left-most bit, and most-significant bit) of each byte, working from least to most significant, and shift the rest of the bytes accordingly:
Thus the value:
00000001 00000110 00010100 11000001
becomes
00001000 00011000 00101000 01000001
This has the side-effect of reducing the capacity of our integer from being 32 bits to being 28 bits, but in the context of ID3 tags that limitation is irrelevant.
For my own program, I achieved this shift by using a bit mask to take each group of bits I want to operate on in turn, applying the mask as a bitwise AND to the integer, and then shifting the requisite number of positions to the right.
I then bitwise ORed the results together:
return ((in & 0x0000007F) |bit mask %00000000 00000000 00000000 01111111
((in & 0x00003F80) << 1) |bit mask %00000000 00000000 00111111 10000000
((in & 0x001FC000) << 2) |bit mask %00000000 00011111 11000000 00000000
((in & 0x0FE00000) << 3));bit mask %00001111 11100000 00000000 00000000
g a sync-safe integer from a regular integer.
The decoding sequence is just the reverse:
return ((in & 0x0000007F) | // bit mask %00000000 00000000 00000000 01111111
((in & 0x00007F00) >> 1) |bit mask %00000000 00000000 01111111 00000000
((in & 0x007F0000) >> 2) |bit mask %00000000 01111111 00000000 00000000
((in & 0x7F000000) >> 3)); // bit mask %01111111 00000000 00000000 00000000
In both cases, the ORed instructions are independent of each other in the sense that each has its bitmask applied and is shifted BEFORE all four results are ORed together.
And using this approach I was able to now correctly identify the length of the ID3 tags. Note, this value includes any padding at the end of the tags and before the audio data.
So that's sync safe integers - something you'll never encounter outside the realms of writing a decoder for ID3 tags.
As one would expect, YouTube has myriad resources for the Welsh learner, ranging from brief clickbait like "An American tries to speak Welsh" to full episodes of educational programmes and everything in between.
The first port of call, really before going any further, is to watch the Welsh Plus series which go into great detail about how to pronounce the letters of the Welsh alphabet, both individually and in common combinations. They also touch on the mutations. Welsh Plus's playlist can be found
here.
When I started learning Welsh, and before I'd discovered the Say Something in Welsh website, I discovered a series of videos called "Learn Welsh with Will" in which Will Huw, an Englishman living in Wales, disseminates his own Welsh knowledge as he goes about learning it. I liked Will's videos as he comes across as non-judgemental and very amiable. You can see Will's playlists, which include more than just Learn Welsh With Will,
here.
Another series of videos I happened upon are aimed at adult learners from the 1990s, Now You're Talking (conveniently mis-spelled as "Now Your Talking" by whomever uploaded them!). These are presented by the likeable Elin Rhys in a variety of very early 90s outfits! There are 36 full half-hour episodes covering a variety of topics and gradually building vocabulary. I enjoy these videos as they present a chance to hear simple conversations in Welsh and learn everyday vocabulary. My only criticisms are that the programmes are now quite dates, the language is in some places a little too old-fashioned, and the pace of the lessons is a little slow for my liking. There's also not a great focus on grammar, so you'll need other resources to accompany these. You can find all 36 videos
here.
Much more recent, are Margaret Hall's wonderful videos. Margaret is a Welsh learner and as part of her learning process she's created a series of videos in which she explores various places in Wales. Margaret speaks very clearly and uses a great vocabulary for the upper-beginner or intermediate Welsh learner. I find I can understand a lot of what she says, but not everything. That's due to limitations in my Welsh, though, not any problems with her speaking. Margaret's channel is
here.
Finally, the Easy Languages series have several videos in Welsh. These are largely conversations with Welsh speakers in towns and establishments around Wales, conducted entirely in Welsh. The videos are subtitled in both English and Welsh, which is both a blessing and a curse, as you can find yourself reading the English subtitles rather than understanding the spoken Welsh. The ease of understanding the spoken Welsh depends largely on the speaker. Some interviewees are fluent speakers, some only beginners, but the most encouraging thing I took from these videos is that, actually, Welsh is very fluid, Welsh speakers are very forgiving of mistakes and, in reality, things like mutations are not nearly as stuck-to as online guides may lead you to believe. You can find those videos
here.
There are plenty more besides, but these are the video series that I've found most useful and most enjoyable while learning Welsh. Feel free to comment if you feel I've missed anything important!
Da bo am y tro!
Ffenestri (Windows), by Lois Arnold, herself a Welsh learner and now an author, is a wonderful collection of stories and poems aimed at adult learners. Arnold cleverly divides the book into graded sections aimed at different levels of learner from mynediad (entry level) to canolradd (intermediate). Each section contains stories and poems on a variety of themes, meaning there's something for everyone here.
There's a real satisfaction the first time you finish reading a piece in a new language, and Lois Arnold makes it easy to be satisfied as everyone should find at least something that's within their ability. The stories and poems start using only the present tense, making them accessible even to those who are quite new to Welsh, and the reader is aided by a glossary of new terms at the bottom of every page. The difficulty level then gradually increases as new words and tenses are introduced. The stories and poems cover myriad subjects from cases of mistaken identity, to muddy festivals, space exploration and quiz nights. And they're not just filler material; each story and poem is a good piece in its own right.
I got great enjoyment from Ffenestri and it's a book I would recommend to anyone just starting out in Welsh. The short nature of the pieces means you don't get bogged down in a long story, and if you happen to pick something a little too difficult you're not stuck with it for the long run. The glossary means you're not constantly referring to a dictionary and thus interrupting your flow and enjoyment of the material.
I've realised that this blog has strayed somewhat from my original aim of it being about my journey of learning Welsh, and more just my opinion on various language-related things.
So, in a return to its true purpose, this post is a review of the book "Yn Ei Gwsg" (In His Sleep) by Bethan Gwanas.
Dafydd walks in his sleep. It's part of the reason, he suspects, for the breakup of his marriage and it gets him into all sorts of odd situations with his neighbours. One morning, however, it takes a more sinister turn when he wakes up covered in blood - not his own - and sets off with his faithful dog Wmffra to follow the bloody footprints to find out to whom the blood belongs.
The book is not nearly as dark as that synopsis makes it sound. It's actually very light-hearted, humorous and a touch sad in places. Bethan Gwanas writes novels for native Welsh speakers as well as learners, and I think that helps her keep this novel simple yet clearly aimed at adults. The language used has clearly been thought about so that the level remains suitable for the target audience, yet also shows a progression from start to finish and introduces new words and phrases.
I really enjoyed reading it. Unusually for me, I found I could hardly put it down. I think this was partly because it was genuinely an enjoyable story, and partly because the level was pretty much spot-on for my ability (this is set as Lefel Sylfaen) so I found I was able to read straight through most pages without having to resort to a dictionary (the glossary of new terms at the bottom of each page, as is common for Welsh-for-adults books, helps enormously). The language used is more northern in style, but I didn't find this a hindrance at all - in fact it helped to cement some knowledge of northern dialect that I'm bound to encounter in the wild anyway.
The last book I read before this was "Ffenestri" by Lois Arnold. If you've read up to the end of the Sylfaen level in that, you shouldn't have any problems with this and I'd recommend it as not only a good book for learners, but a good read in its own right.
Last month, I completed the Welsh tree on DuoLingo. By "completed" I mean that I got all of the units up to at least level 2. That means I've covered material up to and including Canolradd level. I should be practically fluent by now, right?
Errr, no. I'm doing OK reading through my Welsh short stories book ("Ffenestri", by Lois Arnold - I highly recommend it) and I'm understanding more on Radio Cymru each time, but I just don't get enough chances to speak for my brain to engage quickly enough when I need to put a sentence together.
That said, DuoLingo has definitely helped broaden my vocabulary, and I'm often surprised by the sorts of sentences I can put together, but I don't think DuoLingo alone can get you fluency. For that, much more exposure to the spoken language and the way people speak it is needed.
Ok, so it's been about seven months since I started learning Welsh in earnest, and he's what I think is hard and what I think is fairly easy about Welsh:
1. Mutations. Letters change at the start of one word depending on what word they follow. However I'm finding that this starts to feel more natural in most circumstances after a while.
2. Versions of "about" and "of/from" for each pronoun. If you're talking about a thing, they're "am" and "o" respectively. But if you're talking about/from me, you, her, him, us or them you're looking at "amdana, amdanat, amdani, amdano, amdanon and amdanyn" and "ohono, ohonot, ohoni, ohono, ohonon and ohonyn"!
3. The letter "Ll". Yes, it counts as one letter. The pronunciation is somewhere between ell and hissing like an angry goose with a headache. For some reason I find it easier to pronounce at the start of a word, like Llawr, than in the middle or end of a word, like Arall or Galla.
4. Conjugations. Well, this is the same for any language, really. Remembering the conjugations of short-form verbs is just one of those things you have to get used to.
5. Yes and no. There are no words for Yes and No in Welsh, you just repeat back (or negate) the appropriate conjugation of the verb in the question. "Do you like cheese?", "I do". "Are you tired?" "I am". "Are you reading?" "I am not". But that's only in the present tense. In the past tense it's usually "Do" for yes and "Naddo" for no. But then for emphatic questions it's "Ie" for yes and "Nage" for no. If the question was asking if there is something with you (see below) you reply with Oes or Nag Oes. Remembering which to use is the hard part.
6. There aren't many words that are similar to other European languages. There are some, mostly more modern words borrowed from English: tacsi, parcio, ffatri, ffôn, beic, etc; and some ecclesiastical words like eglwys (church) and capel (chapel) but not to the extent that you find with Romance or Germanic languages.
Things that are easier than I expected:
1. Mutations. Yes, they're difficult, but actually you get used to them, and in many cases the rules are quite consistent. You just get used to dropping the G in words like gweithio and gweld when they follow a sentence subject. You get used to changing D to Dd in adjectives after "yn", and you get very used to nasal mutations after "fy".
2. Conjugations. Although remembering them is difficult, many of the conjugations are quite consistent and actually fit in quite well with the pronoun they go with.
3. Possession. I've said before about there being no form of "I have a (something)" in Welsh, they instead say something is "with them": Mae ci gyda fi - "There is a dog with me". I got the hang of this much quicker than I thought. I think you just change your way of thinking and everything slots together.
4. The language as a whole. I'm only a beginner. Very much so. But I've been surprised at how much I've covered in such a short space of time. I'm not proficient by any stretch of the imagination, and I can only string together fairly simple sentences, but on the other hand I can make many more types of sentences in Welsh than my partner's daughter can in Spanish; a language she's been learning at school for two years now. I can use the present tense, the past perfect, a sort of imperfect, the future in several forms and some conditional tenses and even a kind of limited subjunctive mood.
On the whole, Welsh has (so far) been easier than I expected. It's not the incomprehensible jumble of letters it always looked like on road signs when we used to visit my Grandma in Rhossili when I was a child. In fact, in many ways it's a lot easier than the languages I'd been taught at school.
I originally signed up to the
SaySomethingInWelsh forums a few weeks ago when I found it quite by accident while searching for information on the use of "sydd" vs "pwy", and my use of the site didn't go beyond reading some of the forum posts.
Today I decided to start their lessons. Learning with SaySomethingInWelsh is quite unlike DuoLingo. The latter presents you with very short lessons based around short sentences you translate into English, write out in Welsh, or match to pictures. Because of its visual nature, learning the written forms of words is essential to the learning process.
SaySomethingInWelsh is quite different. They actively discourage note taking and base their lessons entirely on listening and repeating the material in a fashion a little similar to a Teach Yourself CD. The idea is that you learn by doing.
Despite having worked up to Level 16 on DuoLingo, I decided to start right at the beginning with the SaySomething course, just in case it offered vocabulary I had not come across on DuoLingo, and so that I got the most out of the course.
So far I'm liking it. It's ideal for having in the car while driving, as one might an audio CD. The only disconcerting thing at the moment is the pronunciation of the speaker, who is a native speaker from the South East. I'm familiar with pronouncing words with "ae" to sound as "eye", whereas he pronounces them more like "ah". Thus "cymraeg" to me sounds like "cum-rye-g" but to him is more "cum-raag". I'm not going to argue with him; he's a native speaker, after all, but it takes some getting used to. I can only assume my pronunciation is either more "standard" or more northern.
Even lesson one brought about some new-ish vocabulary for me, so it's looking like a promising new route for learning, with the added bonus of some forums in which to speak to some like-minded learners.
Sometimes I see people on the DuoLingo forums say that they ultimately want to become fluent in the language they're studying. That strikes me as a lofty ambition.
For someone living in the country of the language they're learning, fluency as a goal makes sense, and in my opinion is probably achievable. Most language learners and teachers agree that the best way to become fluent is to immerse oneself in the language, and the best way to do that is by living in a country where it's spoken.
For someone not living in a country where their language is spoken, fluency must surely be much harder to achieve. Independent study, including reading and watching television programmes in the target language, can increase proficiency (I can't imagine there's such a thing as bad exposure to a language) but ultimately the way to fluency is to hear native speakers. Language, after all, is defined by its use as much as its rules. Language learning with no exposure to its actual use can, however, lead to the sort of hilarity found in the classic
English As She Is Spoke.
I think goals need to be achievable and realistic in order to avoid discouragement. It's better to set a low bar, reach it, and then move on to the next target with a sense of acheivement than to reach too high and become discouraged at an apparent lack of success.
My goal with Welsh is definitely not to become fluent. Not at the moment, anyway. I don't think I'd stand a chance without being surrounded by Welsh speakers and using it every day. My aim is simply to be good enough to understand all the Welsh signs when I'm visiting Wales, to be able to conduct a simple transaction in a shop (actually I'm not that far off, if all I want is a coffee!) and to be able to read novels aimed at learners.
Welsh, like most European languages, assigns nouns a gender. Some of these are obvious: a man (dyn) is masculine. A woman (menyw or dynes) is feminine. A cat (cath) is feminine. A dog (ci) is masculine. Well, that makes sense to me, at least.
But what's a table? Or a bed? Or love?
And how do we differentiate between them? And how do we learn the gender of a new object?
Well, in other European languages you can tell whether a noun is masculine or feminine by the article in front of it. In French, we have the indefinite articles "un" and "une" and the definite articles "le" and "la". When you learn a new word you also learn the gender. While on holiday in Paris in 2003 I asked "Qu'est-ce que c'est?" while holder up a token to use the toilet in a bar, and I got the answer "un jeton". Un. Masculine. And I've never forgotten that a token, in French, is masculine: "un jeton".
So what about Welsh? Welsh doesn't have an indefinite article at all. There is no way of saying "a table" or "an apple", it's just "bwrdd" and "afal". There IS a definite article ("the table" or "the apple") and it has three forms:
Y for words following and preceding a consonant
Yr for words preceding a vowel, but following a consonant
'r for words following a vowel (regardless of what follows it)
Sadly, none of these differentiate by gender, so it's almost impossible when learning a new word as part of conversation or when reading to tell whether it's masculine or feminine. And it's this that is, so far, the most frustrating thing about learning Welsh. I find myself looking up words that I already know just to determine their gender. While writing this I had to check to see if "coffi" (coffee) is feminine (it isn't).
So, does that matter? Well, yes! Welsh also has no gender-neutral word for "it". When talking about an object you refer to it as either he or she depending on its gender. When talking about the weather, for example, you refer to "she". "Mae hi'n oer" is "it's cold", only it's really "she's cold". And not only that, but certain words mutate in certain ways depending on context and gender. Would a Welsh person understand you if you were to get a gender wrong? Yes, of course. But it would grate. It wouldn't sound right. And if I'm going to learn a language, I'm going to do it right.